Skip to content

Accessibility fixes for header and global elements - #10310

Merged
MorrisJobke merged 12 commits into
masterfrom
accessibility-header
Jul 24, 2018
Merged

Accessibility fixes for header and global elements#10310
MorrisJobke merged 12 commits into
masterfrom
accessibility-header

Conversation

@jancborchardt

@jancborchardtjancborchardt commented Jul 20, 2018

Copy link
Copy Markdown
Member

Fix#9994 and fix#10008 🎉

  • Settings icon / avatar: fix opening on enter
  • Contacts: fix opening on enter
  • Notification icon: fix keyboard tab feedback and opening on enter: Fix header icon accessibility notifications#146
  • Fix Upload in +Menu not launching when using keyboard

cc @nextcloud/accessibility :)

@jancborchardtjancborchardt added this to the Nextcloud 14 milestone Jul 20, 2018
@jancborchardtjancborchardt changed the title [Wor k Accessibility fixes for header and global elements[Work in progress] Accessibility fixes for header and global elementsJul 20, 2018
@jancborchardt

Copy link
Copy Markdown
MemberAuthor

Could use some help with JS here on how to do the trigger using enter so that it works for all .menutoggle elements and we don’t need to change the markup. @nextcloud/javascript or what do you think?

Similar for the Unable to open file or folder with keyboard#10008 issue where pressing enter on a folder/file opens the sidebar instead of opening the folder/file itself.

jancborchardtand others added 8 commits July 20, 2018 23:19
Signed-off-by: Jan-Christoph Borchardt <hey@jancborchardt.net>
Signed-off-by: Jan-Christoph Borchardt <hey@jancborchardt.net>
Signed-off-by: Jan-Christoph Borchardt <hey@jancborchardt.net>
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Signed-off-by: Jan-Christoph Borchardt <hey@jancborchardt.net>
Signed-off-by: Jan-Christoph Borchardt <hey@jancborchardt.net>
Signed-off-by: Jan-Christoph Borchardt <hey@jancborchardt.net>
Signed-off-by: Jan-Christoph Borchardt <hey@jancborchardt.net>
@jancborchardtjancborchardt changed the title [Work in progress] Accessibility fixes for header and global elementsAccessibility fixes for header and global elementsJul 20, 2018
@jancborchardtjancborchardt added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Jul 20, 2018
@jancborchardt

Copy link
Copy Markdown
MemberAuthor

This is now ready to review, together with the related Notifications pull request at nextcloud/notifications#146

Please check @nextcloud/accessibility @nextcloud/designers :)

@tyrylutyrylu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

From the point of view of the markup and script changes, it looks alright and useful, so thank you.

Comment threadapps/files/js/newfilemenu.js Outdated

// Trigger upload action also with keyboard navigation on enter
this.$el.find('[for="file_upload_start"]').on('keypress', function() {
$('#file_upload_start').trigger('click');

@kevgathukukevgathukuJul 21, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@jancborchardt Right now this is triggered for every keypress.
Ideally, only the Enter and Spacebar keys should activate the functionality.
A potential fix would be something like this:

this.$el.find('[for="file_upload_start"]').on("keypress", function(event) {
if (event.key === " " || event.key === "Enter") {
$("#file_upload_start").trigger("click");
}
});

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@jancborchardt yup, we forgot this one! :)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

@kevgathuku ah right! Do you want to add a commit to the pull request? :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@jancborchardt sure. I'll add it

@skjnldsv

skjnldsv commented Jul 21, 2018

Copy link
Copy Markdown
Member

Fix #9994 too?
Arf, was already there :)

this.$el.find('[for="file_upload_start"]').on('keypress', function() {
$('#file_upload_start').trigger('click');
this.$el.find('[for="file_upload_start"]').on('keyup', function(event) {
if (event.key === " " || event.key === "Enter") {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for your commit! 🎉

Why not use the codeKey?
Is there a special reason for allowing the " " ? :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @skjnldsv
Thanks 👍

Why not use the codeKey?

The keyCode is deprecated and event.key is preferred instead.

Is there a special reason for allowing the " " ? :)

For this instance, the behavior is more like a button, which is usually activated using either the Spacebar (" ") or Enter keys. I'm thinking it would be better to stick to this convention.

Let me know whether this makes sense 😄

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice! Thanks for the tip, I did not know it was deprecated :)

Can you also move the edits we dit Jan and I from keyCode to key?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sure! I'll make the edits.

Comment threadcore/js/js.js Outdated
event.preventDefault();

// allow enter key as a trigger
if (event.keyCode && event.keyCode !== 13) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should key instead

Comment threadcore/js/js.js Outdated
$(document).on('mouseup.closemenus', function(event) {

// allow enter as a trigger
// if (event.keyCode && event.keyCode !== 13) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should key instead

@kevgathuku
kevgathukuforce-pushed the accessibility-header branch from 7df461d to d2e9e22CompareJuly 23, 2018 08:21
@skjnldsvskjnldsv added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Jul 23, 2018
@MorrisJobke

Copy link
Copy Markdown
Member

CI is here: https://drone.nextcloud.com/nextcloud/server/9129

@MorrisJobke

Copy link
Copy Markdown
Member

@MorrisJobkeMorrisJobke added 2. developing Work in progress and removed 4. to release Ready to be released and/or waiting for tests to finish labels Jul 23, 2018
@MorrisJobkeMorrisJobke mentioned this pull request Jul 24, 2018
21 tasks
jancborchardtand others added 4 commits July 24, 2018 18:58
Before, the file or folder was opened when clicking on the name span,
but not when clicking on the link that contains the name; clicking on
the link highlighted the file and opened the sidebar, just like clicking
on the file size or date. Now clicking on the link opens the file or
folder, so the unit tests that tested clicks on the link were changed to
test clicking on the file size instead.
Signed-off-by: Jan-Christoph Borchardt <hey@jancborchardt.net>
Signed-off-by: Jan-Christoph Borchardt <hey@jancborchardt.net>
Signed-off-by: Kevin Ndung'u <kevgathuku@gmail.com>
Signed-off-by: Kevin Ndung'u <kevgathuku@gmail.com>
@danxuliu
danxuliuforce-pushed the accessibility-header branch from d2e9e22 to fe25092CompareJuly 24, 2018 17:03
@danxuliu

Copy link
Copy Markdown
Member

I have amended the offending commit and fixed the JavaScript unit tests ;-)

@MorrisJobke
MorrisJobke merged commit a96137e into masterJul 24, 2018
@MorrisJobke
MorrisJobke deleted the accessibility-header branch July 24, 2018 22:07
@jancborchardt

Copy link
Copy Markdown
MemberAuthor

Thanks @skjnldsv@kevgathuku@danxuliu for the help! :) This is another great fix for better accessibility.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. developingWork in progressbugdesignDesign, UI, UX, etc.feature: accessibility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to open file or folder with keyboard Keyboard accessibility

6 participants

@jancborchardt@skjnldsv@MorrisJobke@danxuliu@tyrylu@kevgathuku