Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.0] Filtered item information [a11y] #28997

Merged
merged 8 commits into from
May 9, 2020
Merged

Conversation

brianteeman
Copy link
Contributor

@brianteeman brianteeman commented May 8, 2020

In a previous pull request I added code which adds a caption to every table AND indicates how the table is sorted. This is only visible to screen readers. This is very important for accessibility so a user will now all the relevant information for the table being displayed

To improve this further it should also include how the table is filtered.

I have only enabled this for the table of contacts at this time. If/when approved I will do the same for the other tables.

This PR will also allow the designers to add a visual display of the filters which people like @angieradtke have suggested

I also had to use real label strings for the filters instead of re-using the string from the option. I should have done this before but ...

Thanks to @wilsonge for fixing the js

(as this is javascript it will require eithernpm i or node build.js --compile-js to test it)

Testing is really simple

Once the pr has been applied and the js compiled go to the list of all contacts in the admin

If you view source you will see
image

Play around adding filters and it will change as below
image

A screen reader will see the text as
Table of Contacts, Sorted by: Title - descending, Filtered by: Status: Published

@joomla-cms-bot joomla-cms-bot added Language Change This is for Translators NPM Resource Changed This Pull Request can't be tested by Patchtester PR-4.0-dev labels May 8, 2020
@Quy
Copy link
Contributor

Quy commented May 8, 2020

Add a space after Sorted by:

output is now
Table of Contacts, Sorted by: Title - descending, Filtered by: Status: Published
…ter value

Table of Contacts, Sorted by: Title - descending, Filtered by: Status - Published
captionContent = `${element.labels[0].textContent} - ${element.options[element.selectedIndex].text}`;
}

document.getElementById('filteredBy').textContent += captionContent;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can replace document.getElementById('filteredBy') with filteredByCaption, as you've defined it as a variable above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


if (element.multiple === true) {
const selectedOptions = element.querySelectorAll('option:checked');
const selectedTextValues = Array.from(selectedOptions).map((el) => el.text);
Copy link
Member

@C-Lodder C-Lodder May 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't use Array.from(...) as it's not support in IE11. Use [].slice.call(selectedOptions)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/me confused

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

about?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we supporting ie11 or not

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the JS, yes apparently

@wilsonge wilsonge merged commit ada4e58 into joomla:4.0-dev May 9, 2020
@wilsonge
Copy link
Contributor

wilsonge commented May 9, 2020

Thanks!

@wilsonge wilsonge added this to the Joomla 4.0 milestone May 9, 2020
@brianteeman
Copy link
Contributor Author

Right I guess I need to do all the other components now

@brianteeman brianteeman deleted the filtered branch May 9, 2020 12:33
brianteeman added a commit to brianteeman/joomla-cms that referenced this pull request May 9, 2020
Completes the work from joomla#28997

Testing is the same
wilsonge pushed a commit that referenced this pull request May 9, 2020
[4.0] Filtered Item Information work continued from #28997
sakiss pushed a commit to sakiss/joomla-cms that referenced this pull request Oct 16, 2020
Table of Contacts, Sorted by: Title - descending, Filtered by: Status - Published
sakiss pushed a commit to sakiss/joomla-cms that referenced this pull request Oct 16, 2020
[4.0] Filtered Item Information work continued from joomla#28997
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Language Change This is for Translators NPM Resource Changed This Pull Request can't be tested by Patchtester
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants