-
Notifications
You must be signed in to change notification settings - Fork 86
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
Add live regions logic #687
Conversation
7d6c8cf
to
55328aa
Compare
d1344de
to
69c25f5
Compare
cc @BabyElias I hope you can use this from your table work after we get it merged and released. You're welcome to review too, all of it, or parts of it! Whatever work time-wise. |
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.
Thanks you @MisRob! This looks good to me! Just had a concern about what would happen if we directly mounted the live region in the KThemePlugin, and a couple of optional things I noticed.
All feedback is resolved @AlexVelezLl, thank 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.
LGTM! Thank you @MisRob! :)
Description
useKLiveRegion
composable with public methods for updating the live regions with assertive and polite messages.See "Comments" section below on why this strategy, after all.
Issue addressed
Changelog
useKLiveRegion
composable with public methods for updating the live regions with assertive and polite messages.useKLiveRegion
useKLiveRegion.sendPoliteMessage
anduseKLiveRegion.sendAssertiveMessage
to update the live regions that KDS inserted to document body during installation.Steps to test
Implementation notes
At a high level, how did you implement this?
document.body
via plain JavaScript when DOM is loadeduseKLiveRegion.sendPoliteMessage
anduseKLiveRegion.sendAssertiveMessage
to update the region elementsDoes this introduce any tech-debt items?
Opposite - after we use it more widely, it will fix several places utilizing live regions that don't work in our applications at all. Furthermore, it follows the recommended practices that will fix major a11y issues with live regions we're having.
Testing checklist
If there are any front-end changes, before/after screenshots are includedReviewer guidance
After review
CHANGELOG.md
Comments
I explored several approaches regarding inserting live region elements and their many combinations, some of the more important ones:
Mounting
KLiveRegion.vue
as a Vue componentdocument.body
{{ message }}
changes not being announced properly when compared to using plain JS to update elements'textContent
Adding
mounted
hook to KThemePlugin's mixin, where we check ifthis.$root === this
and if so, we insert the live regions to DOM at this pointmounted
to every KDS component, not just when mounted for the first time, but every time (called hundreds of times when navigating in Kolibri)Adjusting Vue prototype's
$mount
and some other places in a way similar to aboveExposing
mountLiveRegions
publicly and instructing apps to call it in the root appmounted
mounted
conditions being executed, it really didn't help with the live regions not being ready in time when announcing very shortly after Kolibri loadedNote that @rtibbles also mentioned some other Vue prototype places that we may want to experiment with. However, at the end of the day, since we need to update
DOM
as soon as possible, after seeing above, I can hardly imagine something faster than utilizingdocument.readyState
andDOMContentLoaded
event.The original reason for not using this strategy was my wish to attach
KLiveRegion
as Vue component as well as a Nuxt problem. However, those can be overcome easily and I think reliability and robustness in consumer apps is the most important criteria here.