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

fix(files): Fix checkbox state semantics #42949

Merged
merged 2 commits into from Jan 20, 2024
Merged

Conversation

Pytal
Copy link
Member

@Pytal Pytal commented Jan 18, 2024

Opening for review in advance

Summary

  • To fix the semantics of checkboxes we remove the "select" / "unselect" wording from the labels
  • Switch it to "toggle" and make use of the native checked and indeterminate input states

Checklist

const label = this.isNoneSelected || this.isSomeSelected
? this.t('files', 'Select all')
: this.t('files', 'Unselect all')
const label = t('files', 'Toggle selection for all files and folders')
Copy link
Member

Choose a reason for hiding this comment

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

Aren't we loosing context here ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess not because it will be announced like checkbox - checked - Toggle selection for all files and folders or checkbox - unchecked - Toggle selection for all files and folders

Copy link
Member Author

Choose a reason for hiding this comment

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

Accessibility best practices suggest not doubling information that is already available e.g. a popup menu label should not say "Close menu" when opened or "Open menu" when closed when the state is already communicated with aria-expanded

Copy link
Contributor

@emoral435 emoral435 left a comment

Choose a reason for hiding this comment

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

After reading through the issue title change, I agree with the choice of using the wording 'Toggle', etc. instead of select/deselect and using the other native accessibility tools to aid the user. This LGTM!

@emoral435
Copy link
Contributor

image

I will say though, on a side-note: the value for the input label isnt being shown on the DOM. I could be wrong, and there could be a different way telling us which checkboxes are input, but isn't this also an a11y issue we should work on? Outside of the aria-label, are there any other native tools that let the user know they checked the box?

@Pytal
Copy link
Member Author

Pytal commented Jan 19, 2024

Thanks for the review @emoral435!

I will say though, on a side-note: the value for the input label isnt being shown on the DOM. I could be wrong, and there could be a different way telling us which checkboxes are input, but isn't this also an a11y issue we should work on? Outside of the aria-label, are there any other native tools that let the user know they checked the box?

Don't know where it is in Firefox devtools but in Chrome you can see checked state in the Properties tab or just access the el.checked property in the console

edit: From MDN "A boolean attribute indicating whether this checkbox is checked by default (when the page loads). It does not indicate whether this checkbox is currently checked: if the checkbox's state is changed, this content attribute does not reflect the change. (Only the HTMLInputElement's checked IDL attribute is updated.)" -https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox#checked

@emoral435
Copy link
Contributor

No problem, @Pytal! Thank you for the MDN reference! Your PR is still great, just wanted to bring up the topic because I'm not all too familiar with this, but I checked this on Chrome and I see the checked property! Sweet :)

@skjnldsv skjnldsv added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Jan 20, 2024
Signed-off-by: Christopher Ng <chrng8@gmail.com>
@skjnldsv skjnldsv force-pushed the fix/a11y/files-checkbox-label branch from 54ceff8 to 1b0eb2b Compare January 20, 2024 11:23
@skjnldsv
Copy link
Member

/compile

Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
@skjnldsv
Copy link
Member

/backport to stable28

@skjnldsv skjnldsv merged commit a6c309f into master Jan 20, 2024
42 checks passed
@skjnldsv skjnldsv deleted the fix/a11y/files-checkbox-label branch January 20, 2024 11:53
@susnux susnux modified the milestones: Nextcloud 28.0.3, Nextcloud 29 Jan 23, 2024
@blizzz blizzz mentioned this pull request Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release Ready to be released and/or waiting for tests to finish accessibility bug feature: files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants