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

cs/move aria label #6269

Merged
merged 4 commits into from Mar 20, 2022
Merged

Conversation

devceline
Copy link
Contributor

@devceline devceline commented Mar 12, 2022

Issue: #5953

Effects

  • Aria-label now forwarded to the modal instead of its child

Verify

  • Edit the example modal to have an aria property like aria-label="foo". Previously the prop would be passed to the first child instead of the parent

Quick note:

This is my first time contributing to a big library like this, please let me know if anything should be changed in PR/code formatting. Thank you.

@kyletsang
Copy link
Member

I think we should just forward aria-describedby and aria-label to the dialog. Don't need to map all aria properties.

@devceline
Copy link
Contributor Author

devceline commented Mar 15, 2022

I think we should just forward aria-describedby and aria-label to the dialog. Don't need to map all aria properties.

But isn't it more intuitive that the props you pass to a component go to what it is rendering directly, and also more accessibility friendly?

const Component = (props) => {
  return (
    <div {...props}> {/*It makes sense that props would be forwarded here*/}
      <span {...props}> </span> {/* instead of here */}
    </div>
  )

May I ask why single out only 2 aria props? Is there an accessibility bonus to giving to the child vs. the parent?

@kyletsang
Copy link
Member

According to the accessibility docs on dialogs, you would only really need the two aria properties anyways (aria-label might be debatable because a modal should have a visible title?).

@devceline
Copy link
Contributor Author

According to the accessibility docs on dialogs, you would only really need the two aria properties anyways (aria-label might be debatable because a modal should have a visible title?).

Oh alright, do you recommend I close this PR or should I just update it to accept aria-label optionally?

@kyletsang
Copy link
Member

Feel free to amend this PR

- explicitly defining aria-label
@devceline
Copy link
Contributor Author

Feel free to amend this PR

Amended the PR, hope this is satisfactory

@kyletsang
Copy link
Member

Looks good. Could you add a test please?

@devceline
Copy link
Contributor Author

Looks good. Could you add a test please?

Alrighty, added one :) Tried to follow the same test for the labelledby

@kyletsang kyletsang merged commit 48f7c07 into react-bootstrap:master Mar 20, 2022
@kyletsang
Copy link
Member

Looks good, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants