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

Feature/#10 modal focus trap #17

Merged
merged 9 commits into from
Oct 19, 2021
Merged

Conversation

zetareticoli
Copy link
Owner

The focus trap issue couldn't be solved in pure CSS. It needs some Javascript.

So, I provided more info about both Focus Trap and Page Scroll Lock features, linking to highly rated npm packages, if needed.

I added the missing HTML aria and role attributes on the modal container.

Check this out and let me know if we need more changes before merge.

@zetareticoli zetareticoli added bug Something isn't working documentation Improvements or additions to documentation labels Oct 14, 2021
@zetareticoli zetareticoli added this to the Accessibility milestone Oct 14, 2021
@zetareticoli zetareticoli self-assigned this Oct 14, 2021

<!-- Modal -->
<div data-modal>
<div id="dialog" data-modal-dialog role="dialog" aria-modal="true" aria-labelledby="modal title" tabindex="-1">
Copy link
Collaborator

@omaxel omaxel Oct 16, 2021

Choose a reason for hiding this comment

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

Using aria-labelledby="modal title" could mislead an inexperienced developer putting the modal title as value of the aria-labelledby attribute. It should refer to element(s) that have the text needed for labeling.

I suggest applying an id to the <h3> element and use the same for the aria-labelledby attribute.

As a reference, this is the same approach used by WAI-ARIA.

Copy link
Owner Author

Choose a reason for hiding this comment

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

You're absolutely right.

@omaxel
Copy link
Collaborator

omaxel commented Oct 17, 2021

The documentation you wrote is a nice way to guide the developer to the problem solution. Thank you @zetareticoli.

@zetareticoli zetareticoli merged commit 69b5b7c into dev Oct 19, 2021
@zetareticoli zetareticoli deleted the feature/#10-modal-focus-trap branch October 19, 2021 08:22
zetareticoli added a commit that referenced this pull request Nov 11, 2021
* Fix: Accordion focus on closed panel child element (#14)

* Fix: Accordion focus on closed tab child element

* Updated accordion documentation

* Added generated file

Co-authored-by: Omar Muscatello <7016897+OmarMuscatello@users.noreply.github.com>

* Feature/#10 modal focus trap (#17)

* Added role and aria-modal attributes, adde x icon to close #10

* Added aria-labelledby #10

* Added tabindex to close button #10

* Added more documentation about Focus Trap and Page Scroll #10

* Change modal template #10

* Changed blockquote style #10

* Better doc #10

* Fixed aria-labelledby attribute #10

* Changed styel

* Feature/#7 components docs (#18)

* Added more content to Tabs doc #7

* Changed lead color #7

* Added support for :focus event on tooltips #7

* Changed Tooltips docs #7

* Show ring on focused tab panel's label (#20)

Co-authored-by: Omar Muscatello <7016897+OmarMuscatello@users.noreply.github.com>

* Removed container parent maintaining accessibility (#24)

Co-authored-by: Omar Muscatello <7016897+OmarMuscatello@users.noreply.github.com>

* Added focus ring on focused accordion item's label (#25)

Co-authored-by: Omar Muscatello <7016897+OmarMuscatello@users.noreply.github.com>

* Improved tabs accessibility (#23)

Co-authored-by: Omar Muscatello <7016897+OmarMuscatello@users.noreply.github.com>

* Removed accordion container from HTML preview #24

* Added information to CHANGELOG

* Added upcoming release info

* Added accessibility info for tabs

* Bumped lib version for npm package

* Fixed tabs accessibility doc

Co-authored-by: Omar Muscatello <7016897+omaxel@users.noreply.github.com>
Co-authored-by: Omar Muscatello <7016897+OmarMuscatello@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants