-
Notifications
You must be signed in to change notification settings - Fork 221
Product Gallery: Add keyboard access #11373
Conversation
The release ZIP for this PR is accessible via:
Script Dependencies ReportThere is no changed script dependency between this branch and trunk. This comment was automatically generated by the TypeScript Errors Report
🎉 🎉 This PR does not introduce new TS errors. |
Size Change: +246 B (0%) Total Size: 1.54 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
}; | ||
|
||
document.addEventListener( 'keydown', handleKeyEvents ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we remove this event listener when the gallery is not open?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we probably should but I haven't found an elegant way to do that in this context. Any suggestions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reasons it is only showing 3 images in the gallery for me. Is this expected?
Yes that's expected and being worked on else where.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we probably should but I haven't found an elegant way to do that in this context. Any suggestions?
I'm also not sure, maybe somewhere we're handling the click. I'll take a deep dive into it and get back to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work in here @roykho. Allowing shoppers to navigate between images using keyboard keys definitely improves the user experience. I've left some suggestions in the code, but I'm pre-approving this PR, since it's not a blocker 🚀
What
Fixes #11284
Adds keyboard access (ESC, LEFT ARROW, RIGHT ARROW) to the Product Gallery overylay/dialog/lightbox.
Why
By adding keyboard access to the Product Gallery overlay/dialog/lightbox, it makes it more accessible and better UX.
Testing Instructions
Please consider any edge cases this change may have, and also other areas of the product this may impact.
WooCommerce Visibility
Required:
Checklist
Required:
[type]
label or a[skip-changelog]
label.Conditional:
[skip-changelog]
label is not present).Changelog