Skip to content

aria-modal attribute set on wrong element? #30516

@kosmiq

Description

@kosmiq

Hey all,

I've been looking into an issue raised over at react-bootstrap. We have an issue stating that the attribute aria-modal="true" is added to the wrong element.

So I started looking into it on our end and realized we are doing it the same way as you are, adding it to the background element with the "modal" class.

Our issue raiser linked the following spec: https://amp.levelaccess.net/public/standards/view_best_practice.php?violation_id=1893 and then I looked into the w3 spec here: https://www.w3.org/TR/wai-aria-practices/examples/dialog-modal/dialog.html

Looking at the latter, and opening the example modal there the backdrop does not get either an role="dialog" attribute or aria-modal="true".

So here's how Bootstrap and react-bootstrap does it:
Screenshot 2020-04-06 at 10 21 36

The backdrop styles element gets the aria attribute and role="dialog"
The example on w3 looks like this though:
Screenshot 2020-04-06 at 10 21 54

Note that it is the dialog/modal itself that gets the attributes.

I found the following PR that added the attributes in 4.2.0: #27780

However, someone with more insight or experience with the aria and role specs for modals can perhaps shed some light on this? Are we adding the attributes to the wrong elements or has there been any discussions I've been unable to find regarding this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions