Fix aria-valuenow attibute in ballot progress bar
We were setting it to 0, and so screen reader users might be confused by it. The easiest way to reuse the code and using it for both this attribute and the width of the progress bar is to move this method to the voting style, just like the other methods used in this view. Note the progressbar ARIA role might not be right, since this isn't a task which is "progressing", but an indicator of the amount spent and amount available, which is exactly what the <meter> HTML5 tag was designed for. We might use a <meter> tag in the future. For now, I'm leaving it as it is because I'm not certain about how well <meter> is supported in accessibility tools, and because it's definitely not supported in Internet Explorer 11, which we haven't officially dropped support for.
This commit is contained in:
@@ -66,7 +66,7 @@ class Budget
|
||||
delegate :amount_available, :amount_available_info, :amount_spent, :amount_spent_info,
|
||||
:amount_limit_info, :change_vote_info, :enough_resources?, :formatted_amount_available,
|
||||
:formatted_amount_limit, :formatted_amount_spent, :not_enough_resources_error,
|
||||
:reason_for_not_being_ballotable, :voted_info,
|
||||
:percentage_spent, :reason_for_not_being_ballotable, :voted_info,
|
||||
to: :voting_style
|
||||
|
||||
private
|
||||
|
||||
@@ -34,6 +34,10 @@ class Budget::VotingStyles::Base
|
||||
amount: formatted_amount_limit(heading))
|
||||
end
|
||||
|
||||
def percentage_spent(heading)
|
||||
100.0 * amount_spent(heading) / amount_limit(heading)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def investments(heading)
|
||||
|
||||
Reference in New Issue
Block a user