FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat(switch): add aria-labelledby to input by boaz0 · Pull Request #2468 · patternfly/patternfly-react · GitHub

feat(switch): add aria-labelledby to input - #2468

Merged
tlabaj merged 1 commit into
patternfly:masterfrom
boaz0:close_2435
Aug 2, 2019
Merged

feat(switch): add aria-labelledby to input#2468
tlabaj merged 1 commit into
patternfly:masterfrom
boaz0:close_2435

Conversation

boaz0 commented Jul 7, 2019
edited
Loading

Copy link
Copy Markdown
Member

What:

closes #2435
closes #2600

//cc @jgiardino @tlabaj

Copy link
Copy Markdown
Collaborator

PatternFly-React preview: https://patternfly-react-pr-2468.surge.sh

tlabaj requested review from jgiardino and tlabaj July 8, 2019 17:47
tlabaj self-assigned this Jul 8, 2019
tlabaj requested a review from kmcfaul July 8, 2019 17:48
kmcfaul previously approved these changes Jul 24, 2019

boaz0 commented Jul 25, 2019
edited
Loading

Copy link
Copy Markdown
Member Author

resolved merge conflict. 😄

Copy link
Copy Markdown
Contributor

Thanks for contributing this, @boaz0!

When I modify the first example, and remove aria-label from the component, I see that aria-labelledby is added to the <input> as expected. I also see that id attributes are added to the <input> and also the <span> elements that provide the visible text labels, as expected. 🎉

There are just a couple of updates needed:

  • When aria-labelledby is added to the <input>, it should be set to the id value that is defined on the <span> that is visible during the on state.
    • Currently, the attribute is set to the id value assigned to the <input> as shown below:
      <input id="simple-switch" aria-label="" class="pf-c-switch__input" type="checkbox" aria-labelledby="simple-switch" checked="">
    • Instead, it should render like this:
      <input id="simple-switch" aria-label="" class="pf-c-switch__input" type="checkbox" aria-labelledby="simple-switch-on" checked="">
  • To align with our core examples, let's remove aria-label from the first example, so that the component is defined like this:
        <Switch
          id="simple-switch"
          label={isChecked ? 'Message when on' : 'Message when off'}
          isChecked={isChecked}
          onChange={this.handleChange}
        />
    
    And then when the html is rendered, this will include the aria-labelledby attribute like the example in core.
    • I think this would be sufficient for aligning with the core examples, but if we do decide to have complete alignment, then it's important to note that the react component examples showing the disabled switch would need to include both an on and off label (currently the disabled examples only include a string for the label that's visible).

boaz0 commented Jul 27, 2019

Copy link
Copy Markdown
Member Author

Thanks a lot @jgiardino on your input.

tlabaj commented Jul 30, 2019
edited
Loading

Copy link
Copy Markdown
Contributor

@boaz0 will you be addressing issue #2600 here? A separate PR is good too.

boaz0 commented Jul 30, 2019
edited
Loading

Copy link
Copy Markdown
Member Author

separate PR 👍 unless you will merge it tomorrow

boaz0 commented Jul 30, 2019

Copy link
Copy Markdown
Member Author

@tlabaj @jgiardino @redallen I updated the PR to address #2600 too.

Thanks.

Signed-off-by: Boaz Shuster <boaz.shuster.github@gmail.com>

redallen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM

tlabaj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM

tlabaj merged commit 0f7cd6e into patternfly:master Aug 2, 2019

Copy link
Copy Markdown
Collaborator

Your changes have been released in:

  • @patternfly/react-charts@4.7.3
  • @patternfly/react-core@3.81.0
  • @patternfly/react-docs@4.9.16
  • @patternfly/react-inline-edit-extension@2.9.62
  • demo-app-ts@2.14.6
  • @patternfly/react-table@2.16.2
  • @patternfly/react-topology@2.7.12
  • @patternfly/react-virtualized-extension@1.1.95

Thanks for your contribution! 🎉

boaz0 commented Aug 3, 2019

Copy link
Copy Markdown
Member Author

Thanks @tlabaj @kmcfaul @redallen ! 😄

boaz0 deleted the close_2435 branch August 3, 2019 18:15

Venefilyn commented Sep 2, 2019
edited
Loading

Copy link
Copy Markdown
Contributor

This introduced a breaking change in a minor version (from v3.80.4 to v3.81.0). Prior to this the label prop was be shown both when on and off. Not it only shows when on and not when off.

We have to explicitly add both label and labelOff even when we don't want to change the text. Was this intended?

Opened an issue #2814

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PF4 Switch label props breaking change Switch - add prop for aria-labelledby

7 participants


Back | FazBrowse Home | New Git URL