decaporg / decap-cms

A Git-based CMS for Static Site Generators
https://decapcms.org
MIT License
17.83k stars 3.04k forks source link

Selecting an item from the media gallery is not keyboard accessible and has no role or state #7077

Open daz079 opened 8 months ago

daz079 commented 8 months ago

Describe the bug Using keyboard I should be able to select a media file from the files dialog. Using a screen reader I should hear the role of the item when it receives focus, as well as its current state

To Reproduce In the CMS click either the Choose File or Image widget, use a keyboard, tab to one of the files and press Enter or Space Repeat with a screen reader and listen out for a role

Expected behavior The item becomes "selected" A suitable role is output by the screen reader, along with feedback to indicate it is selected

Screenshots

Applicable Versions: decap-cms-app 3.0.12 decap-cms-core 3.2.8 decap-cms 3.0.12

MacOS 14.1.2

Chrome 121.0.6167.85 Safari Firefox

CMS configuration Not related to config

Additional context What would perhaps work here, is adding role=checkbox to each item (The item currently has tabindex=0 ), then it will have a role Adding aria-checked=true (when checked), then it will have a state For the cardGridContainer wrapper, add role=group or use a fieldset and add an accessible name via aria-labelledby=[ID Ref of the a text node that has the label "Select files" this can be displayed or visually hidden, you can even add display: none; if you wish, as aria-labelledby ignores that Listen for Space press and run the same function as is working for mouse clicks (also, preventDefault to prevent scroll) As an added nicety for screen freader users, add aria-hidden="true" to the card-file-icon, as this is repetitive information, that information exists in the text string of the file name

daz079 commented 7 months ago

@martinjagodic

I'm not totally sure this is a "Feature", it's a Bug, it doesn't work with keyboard at all, that means many users with disabilities cannot use it at all.

If it were broken for mouse clicks, then it would be a bug, right? Kinda the same thing in my opinion, some folks can use a mouse, some can't, the ones that can't are excluded because of their disability, at present.

Any chance you will agree and recategorise this as a bug, so it doesn't get left on the back burner, please?

Thanks

martinjagodic commented 7 months ago

There is no difference in priority with bug vs feature. As keyboard compatibility was never integrated, adding it would be a new feature.