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

A11y Addons control panel #6345

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

deodorhunter
Copy link
Contributor

@deodorhunter deodorhunter commented Sep 27, 2024

This PR overhauls current Addons Control panel UI using react-aria-components and solves #5142.
All accordions removed, UI is now akin to Plone Classic.
Aria pattern used: ARIA grid pattern through GridList component

Changelog:

  • Written in Typescript leveraging @plone/types
  • Component UI overhauled and code splitted, really minor changes to existing logic (types mostly)
  • Updated tests and added new tests and related mocks/fixtures/snapshots for Cypress and Jest/Testing Library.
  • Updated some Addons related types in @plone/types package
  • Added stylesheet and imported it directly in the component, css splitting and lazy loading works as expected. Will move styles in less theme files if deemed better/necessary
  • Translations

UI Preview

image
image

@deodorhunter deodorhunter self-assigned this Sep 27, 2024
@deodorhunter deodorhunter linked an issue Sep 27, 2024 that may be closed by this pull request
Copy link

netlify bot commented Sep 27, 2024

Deploy Preview for plone-components canceled.

Name Link
🔨 Latest commit 7cdd967
🔍 Latest deploy log https://app.netlify.com/sites/plone-components/deploys/67223d4e3d6b7a000816b829

padding: 2rem 1.5rem;
}

#page-addons .btn-primary {
Copy link
Member

Choose a reason for hiding this comment

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

I am not a fan of this styling of button variants where we introduce css overrides.
Since we are starting over and making use of css vars we should have a button class
and variant classes that where possible just modifies the vars.
Have a look at this article where this designer shows how they made their button
component.
https://piccalil.li/blog/how-i-build-a-button-component/#variants

I feel like we still need to adopt a styling methodology and try to use it in the new
components if we are now at the totally breaking future phase.
Will have another look at the plone.contents efforts and plone.components and
come back with further observations for the future.

Copy link
Contributor

Choose a reason for hiding this comment

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

@ichim-david it's out of the scope of this PR to go in the direction of the new theming system. Since we don't know how that will be yet, it sounds like a waste of time for me to make it up in this specific PR. Moreover, Victor and I specifically told everybody working on reimplementing these panels and other views to avoid adding plone/components and such because that's not coming in volto 18 while these fixes should be there if possible.

Copy link
Contributor Author

@deodorhunter deodorhunter Sep 30, 2024

Choose a reason for hiding this comment

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

@ichim-david I understand your concerns, and this kind of "custom temporary styling" is not my preferred style either.
I would have gone with a cva/cva like solution (https://cva.style/docs) if we had a theming convention (at least on paper), but alas that's still a long way in the future from what I understand.
As @pnicolli said, we had a talk about this during the sprint, and decided to avoid using plone/components and unified theming like quanta styles.

After some thinking, a possible edge case issue with my initial implementation of selector naming came to mind: people using custom cms-ui styles, like injecting bootstrap or a custom stylesheet with the same selector naming convention. It would have caused inconsistencies and hassles, so I changed the button selector names to reflect the scope of action of that button (install/install upgrade and uninstall).

@deodorhunter
Copy link
Contributor Author

Update
This pr is now complete with all missing translations in all supported languages. Got some help from our well known GPT buddy, as I would have hated leaving blanks for other languages.
Haven't seen strange/unusual translations during a quick cross check with Translate and Deepl, but you never know...

@ichim-david
Copy link
Member

@pnicolli @sneridagh I've looked at the bundle implication of loading react-aria-components.
It seems that it's not bundled in the default bundle and only used on the addons
react-aria-addons-component
I wonder it react-aria doesn't have better imports to avoid loading the entire library if you only use a couple of components.
Given the fact that we don't load it in the default bundle I'm not against this although I find it a bit strange that we have a dependency on react-aria-components within plone.components and now we load it also in volto core directly.
Whatever you guys decide I'm fine given that we don't fatten the default bundle :).

@pnicolli
Copy link
Contributor

@ichim-david yeah Victor and I discussed this briefly with the people doing stuff with react-aria-components during Salamina Sprint and we said that we wouldn't use plone/components here because it's still alpha and kind of wip officially, but we can use react-aria-components for now, since moving from this to plone/components should remain easy enough.
Regarding a more precise import, we will need to look into it while working on plone/components so I think it's safe to say it's not a big problemi for now.

Copy link
Member

@ichim-david ichim-david left a comment

Choose a reason for hiding this comment

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

I see the following a11y issues:

  1. Verify the warning given by IBM Equal Access Accessibility Checker plugin
  2. I don't like that the screenreader says just listbox and you can only navigate with the arrows. Here it's strange if you use up and down arrow it will jump to the next listbox heading. If you use left or right keys it will read the heading, the install or uninstall button and the description such as "Installs the collective.volto.stickyblocks add-on." When you think of a listbox you think of up and down only so I don't know how many would think to use left or right to get to the button. Luckily it shows up in the form controls rotary so it could be worse.
  3. The headings could use a bit of aria-label for instance what is available, if you just navigate through the headings you might not know what available means.

addons-headings
addons

@ichim-david ichim-david requested a review from a team October 29, 2024 13:14
@deodorhunter
Copy link
Contributor Author

Thanks for your review, I'll try to look at it asap!

I see the following a11y issues:

  1. Verify the warning given by IBM Equal Access Accessibility Checker plugin

I run checks with Accessible Web and Axe and no warning were shown, I'll try this addon too. For future reference, is this what the community usually uses as browser addon for a11y testing? I might have missed this piece of information, sorry if that's the case.

  1. I don't like that the screenreader says just listbox and you can only navigate with the arrows. Here it's strange if you use up and down arrow it will jump to the next listbox heading. If you use left or right keys it will read the heading, the install or uninstall button and the description such as "Installs the collective.volto.stickyblocks add-on." When you think of a listbox you think of up and down only so I don't know how many would think to use left or right to get to the button. Luckily it shows up in the form controls rotary so it could be worse.

I admit this is not the output I get/remember with VoiceOver.
On Chrome I get all the info as a screen reader user
image
image

I'll be checking Safari next, then Firefox.

AFAIK Firefox, is... a bit of a special child and at 2% usage nowadays for many reasons.
If it ends up as a Firefox specific issue, we will have to make a decision about that, given such a low and declining worldwide usage ratio (Edge is at 5%, and that's food for thought for Mozilla, given that usually for Windows non business users, Edge is used once only to download Chrome on a fresh Windows installation 😄 ).
Additionally, if it stems from react-aria-components or it's an os+browser combo accessibility bug, I cannot do much here, but I'll take a look for sure.

  1. The headings could use a bit of aria-label for instance what is available, if you just navigate through the headings you might not know what available means.

addons-headings addons

On it

@stevepiercy
Copy link
Collaborator

I run checks with Accessible Web and Axe and no warning were shown, I'll try this addon too. For future reference, is this what the community usually uses as browser addon for a11y testing? I might have missed this piece of information, sorry if that's the case.

We don't document the tools we use, but we sure ought to.

https://6.docs.plone.org/volto/contributing/accessibility-guidelines.html

I'll update the open PR with the a11y tools that contributors should use (currently only cypress-axe is included), but please help me out by providing a list of their names (I've started that below), what you use them for, and from where to download or install them. Thank you!

  • cypress-axe. Automate accessibility testing with axe-core in Cypress.
  • IBM Equal Access Accessibility Checker plugin.
  • Accessible Web.
  • Voiceover.
  • moar tools

@deodorhunter
Copy link
Contributor Author

I run checks with Accessible Web and Axe and no warning were shown, I'll try this addon too. For future reference, is this what the community usually uses as browser addon for a11y testing? I might have missed this piece of information, sorry if that's the case.

We don't document the tools we use, but we sure ought to.

https://6.docs.plone.org/volto/contributing/accessibility-guidelines.html

I'll update the open PR with the a11y tools that contributors should use (currently only cypress-axe is included), but please help me out by providing a list of their names (I've started that below), what you use them for, and from where to download or install them. Thank you!

  • cypress-axe. Automate accessibility testing with axe-core in Cypress.
  • IBM Equal Access Accessibility Checker plugin.
  • Accessible Web.
  • Voiceover.
  • moar tools

Sure thing, a couple that come to mind and usually use:

  1. Expected to work - these tests show support when accessibility features are used correctly
  2. Expected to fail - these tests show what happens when accessibility features are used incorrectly

The last resource helped me in coming to a conclusion on the differences between Chrome and Firefox and Safari with VoiceOver we were talking about yesterday.
Long story short: it is browser, OS AND Screen Reader dependant. Firefox/Safari + VoiceOver fails with aria-describedby, works if we use aria-label instead.
Which means that as it stands, having only a Mac to work on, I cannot guarantee the result on NVDA/Jaws as they are Windows only platforms. It should work (even better than on Mac looking at stats), but I simply don't know.

On the brighter side, I did a deep dive in rac docs and internals again, and came up with a solution using a specific prop that under the hood displays the passed value as aria-label (I can now guess why).
Contextually, I added another feature: Enter now executes the selected/focused GridListItem action, and updated assistive labels. This is to address your previous point

When you think of a listbox you think of up and down only so I don't know how many would think to use left or right to get to the button. Luckily it shows up in the form controls rotary so it could be worse.

The only downside is that dbl click on GridListItem now executes the same action, I cannot do anything about it due to it being a feature of rac. For some power users it could even be a feature, but we can surely think about that more thoroughly.
I updated the code with these changes, let me know what you think about it

@@ -83,7 +112,8 @@ const AvailableItem: React.FC<AvailableAddonProps> = ({ addon, onInstall }) => {
<GridListItem
key={addon['@id']}
className="addon-item"
aria-describedby={`addon-desc-${addon.id}`}
textValue={`${addon.title} ${addon.description}. ${intl.formatMessage({ id: 'Press Enter to install this addon' })}`}
Copy link
Member

Choose a reason for hiding this comment

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

@deodorhunter you add the period which shows up strange if you don't have an addon. See the test result here 416059d#diff-023c7e608404538c6858332e1915002b4c248049367176e7d0a52f69097794a2R65

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't get why a test on a slate block widget inside a page should be broken by a period in a controlpanel component aria-label which is not even rendered during said test, but if I remove the period, the test passes...
Oh well, fix incoming.
I saw a coresandbox test breaking randomly too, also on blocks, line 125 of blocks.js, is it cypress hooks and locators/selectors failing or is the test outdated/flaky/wrong?
In cy preview, I'm not seeing anything similar to what the selector is looking for
image
What is going on here?
I admit my Cypress skills are rusty, I've been using Playwright lately.

@pnicolli
Copy link
Contributor

@ichim-david Not sure I understand the status today. Are the review comments still open or are they already settled? Are there any blockers among those that are still open? Just trying to figure out if this will make it into v18 or not and how to plan for the future.

@ichim-david ichim-david self-requested a review October 31, 2024 10:30
@ichim-david
Copy link
Member

@ichim-david Not sure I understand the status today. Are the review comments still open or are they already settled? Are there any blockers among those that are still open? Just trying to figure out if this will make it into v18 or not and how to plan for the future.

I have a few more comments that I will add soon. This is an improvement over the previous add-ons control panel so I am not against having it for Volto 18. Overall it's just minor issues left that can be handled. @sneridagh should also give his input on this work.

Copy link
Member

@ichim-david ichim-david left a comment

Choose a reason for hiding this comment

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

@deodorhunter @pnicolli there is no Upgradable, it's Upgradeable. Please rename everywhere in order for it to sound proper when using a screenreader. This also means every import and file name that has Upgradable.

Also please use add-ons instead of addons as it will be read again better by screen readers

@ichim-david
Copy link
Member

ichim-david commented Oct 31, 2024

@deodorhunter @pnicolli there is no Upgradable, it's Upgradeable. Please rename everywhere in order for it to sound proper when using a screenreader. This also means every import and file name that has Upgradable.

Also please use add-ons instead of addons as it will be read again better by screen readers

@deodorhunter @pnicolli ok I was incorrect to mention that there is no upgradable, there is https://en.wiktionary.org/wiki/upgradable#English. However I use American english and not british english and it sounded better for me with upgradeable. I don't know if this is reason enough to change it though, @stevepiercy do you have anything to add on this?

@ichim-david
Copy link
Member

@deodorhunter @pnicolli I would also do the following fixes:

  • align the buttons to the top
  • add a flex-wrap on the header
  • add a class to the div that has the install, update or delete button
    addons-320px-flex-wrap
    addons-320px
    addons-360px

@ichim-david
Copy link
Member

ichim-david commented Oct 31, 2024

@deodorhunter I don't like the behavior of double-clicking on the section which will trigger an install or uninstall. it's not at all obvious and is in fact totally unexpected. I might want to copy some of the text from that section and install I get an install or uninstall

double-click-to-install-or-uninstall.mp4

I see that you mention something about double-clicking performing an action #6345 (comment).
I find this change worse than what we previously had with the left and right arrows. If you can't quickly do something about it I would still disable the double click to perform action.

EDIT:
For that matter, the section isn't a submit button, so I would not allow it to press enter to install but have it install or update or uninstall only with the button action that is clear from the label plus it's semantic which is a button to perform an action.

@ichim-david ichim-david requested a review from a team October 31, 2024 12:17
Copy link
Collaborator

@stevepiercy stevepiercy left a comment

Choose a reason for hiding this comment

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

In my review the changes in volto.pot are authoritative and should be propagated to the other files.

@@ -0,0 +1 @@
Updated incomplete types for addons service response. @deodorhunter
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Updated incomplete types for addons service response. @deodorhunter
Updated incomplete types for add-on service response. @deodorhunter

msgid "Available"
msgstr ""

#. Default: "Available addons"
#: components/manage/Controlpanels/Addons/AddonsControlpanel
msgid "Available addons"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
msgid "Available addons"
msgid "Available add-ons"

msgid "Installed"
msgstr ""

#. Default: "Installed addons"
#: components/manage/Controlpanels/Addons/AddonsControlpanel
msgid "Installed addons"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
msgid "Installed addons"
msgid "Installed add-ons"

@@ -2382,6 +2392,16 @@ msgstr ""
msgid "No"
msgstr ""

#. Default: "No addons available for installation."
#: components/manage/Controlpanels/Addons/AddonsControlpanel
msgid "No Addon available"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
msgid "No Addon available"
msgid "No add-on available"


#. Default: "No installed addons."
#: components/manage/Controlpanels/Addons/AddonsControlpanel
msgid "No Installed available"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
msgid "No Installed available"
msgid "No installed add-ons available"


#. Default: "Press Enter to update this addon"
#: components/manage/Controlpanels/Addons/AddonItem
msgid "Press Enter to update this addon"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
msgid "Press Enter to update this addon"
msgid "Press Enter to update this add-on"

@@ -3812,6 +3852,11 @@ msgstr ""
msgid "Third"
msgstr ""

#. Default: "This addon was updated. Current profile installed version is {installedVersion}. New available profile version is {newVersion}"
#: components/manage/Controlpanels/Addons/AddonItem
msgid "This addon was updated. Current profile installed version is {installedVersion}. New available profile version is {newVersion}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
msgid "This addon was updated. Current profile installed version is {installedVersion}. New available profile version is {newVersion}"
msgid "This add-on was updated. Current profile installed version is {installedVersion}. New available profile version is {newVersion}."

msgid "Updates available"
msgstr ""

#. Default: "Upgradable addons"
#: components/manage/Controlpanels/Addons/AddonsControlpanel
msgid "Upgradable addons"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
msgid "Upgradable addons"
msgid "Upgradable add-ons"

@@ -0,0 +1 @@
Overhaul Addons control panel with accessible UI (react-aria-components) akin to Plone Classic @deodorhunter
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Overhaul Addons control panel with accessible UI (react-aria-components) akin to Plone Classic @deodorhunter
Overhaul Add-ons control panel with accessible user interface (react-aria-components) akin to Plone Classic UI. @deodorhunter

/>
&nbsp;
<a
href="https://6.docs.plone.org/install/"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hold on this. We are in the process of updating the documentation, and the new page is not yet released. See https://github.com/plone/volto/pull/6397/files#diff-5ac1c30eabae6878f93007dc64b3129cc05eaa5f878cd274fc27779edd410276

Suggested change
href="https://6.docs.plone.org/install/"
href="https://6.docs.plone.org/volto/development/add-ons/install-an-add-on.html"

@stevepiercy
Copy link
Collaborator

@ichim-david thanks for the ping.

"add-on" is hyphenated in narrative documentation and any public UI element. "addon" is preferred in code. Where the spelling of "successfully" was corrected, I also corrected the hyphenation of "add-on", but only in volto.pot, as I think the others are auto-generated, except for *.tsx files. In my review the changes in volto.pot are authoritative and should be propagated to the other files. Please propagate those suggestions.

However, I don't know if changing all the non-hyphenated instances of "addon" in the msgids would be a serious breaking change. Can someone inform me?

In any case, it bugs me that we don't use the correct hyphenation or spelling when displaying the text to end users. Perhaps we deal with this misspelling (and probably others that I never reviewed) in a future PR and 18.1 release?

"Upgradeable" is a variant spelling of "upgradable" in American English. Both spellings are acceptable and interchangeable.

@ichim-david
Copy link
Member

@ichim-david thanks for the ping.

"add-on" is hyphenated in narrative documentation and any public UI element. "addon" is preferred in code. Where the spelling of "successfully" was corrected, I also corrected the hyphenation of "add-on", but only in volto.pot, as I think the others are auto-generated, except for *.tsx files. In my review the changes in volto.pot are authoritative and should be propagated to the other files. Please propagate those suggestions.

However, I don't know if changing all the non-hyphenated instances of "addon" in the msgids would be a serious breaking change. Can someone inform me?

If you change it you lose the translations and you need to add them back manually. I added a bug report here #6159 but that was as far as I got.

In any case, it bugs me that we don't use the correct hyphenation or spelling when displaying the text to end users. Perhaps we deal with this misspelling (and probably others that I never reviewed) in a future PR and 18.1 release?

"Upgradeable" is a variant spelling of "upgradable" in American English. Both spellings are acceptable and interchangeable.

@deodorhunter there you have it as I've mentioned here #6345 (comment) I was wrong to jump to the conclusion that it wasn't correct so given how many mentions you have already and since it's also valid there is no point in changing it.

@deodorhunter @stevepiercy Having in the aria-label and visible text add-on instead of addon made a considerable change to how VoiceOver spelled the word so we need to change it, being ok to have it in the code variables due to - not being acceptable.

@ichim-david
Copy link
Member

@ichim-david Not sure I understand the status today. Are the review comments still open or are they already settled? Are there any blockers among those that are still open? Just trying to figure out if this will make it into v18 or not and how to plan for the future.

@pnicolli given Victor announcement that a48 is the final this for sure won't make it in 18 final but having it in 18.1 means that you get more feedback besides my own, I know that @JeffersonBledsoe also wanted to add something but cannot do it until tomorrow.

@stevepiercy
Copy link
Collaborator

If you change it you lose the translations and you need to add them back manually. I added a bug report here #6159 but that was as far as I got.

In that case, let's not change existing addon, but we should change new addon to add-on, just as I did in my review. We can address existing misspellings in the future, if we can figure out how to do so without being destructive.

@pnicolli
Copy link
Contributor

pnicolli commented Oct 31, 2024

@pnicolli given Victor announcement that a48 is the final this for sure won't make it in 18 final but having it in 18.1 means that you get more feedback besides my own, I know that @JeffersonBledsoe also wanted to add something but cannot do it until tomorrow.

@ichim-david yeah after reading replies here I briefly texted Victor to pull the trigger without waiting for this. I am just afraid this will become stale if we go too deep in optimization. I would like to set a goal to have this finished by the end of the month at the latest.

@davisagli
Copy link
Member

If you change it you lose the translations and you need to add them back manually. I added a bug report here #6159 but that was as far as I got.

In that case, let's not change existing addon, but we should change new addon to add-on, just as I did in my review. We can address existing misspellings in the future, if we can figure out how to do so without being destructive.

We can change the defaultMessage of existing translations but leave the msgid the same.

@stevepiercy
Copy link
Collaborator

Sure thing, a couple that come to mind and usually use:

Added in 21505f5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

a11y - site setup - Addon-ons - cms ui
5 participants