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

feat(TextInputGroup): added disabled styling #4484

Merged

Conversation

wise-king-sullyman
Copy link
Contributor

Closes #4482

@patternfly-build
Copy link

patternfly-build commented Nov 1, 2021

Preview: https://patternfly-pr-4484.surge.sh

Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

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

Looks really good! A few bits of feedback.

wise-king-sullyman and others added 2 commits November 1, 2021 18:16
Co-authored-by: Michael Coker <35148959+mcoker@users.noreply.github.com>
- gave Color a default value
- set pointer-events to none
- disabled borders
- added aria-label
- added tabindex of -1
- added text-input-group--IsDisabled to template to enable quick
changes of components from enabled to disabled
Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

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

Coming together nicely! Left some feedback

{{#if text-input-group--attribute}}
{{{text-input-group--attribute}}}
{{/if}}
{{#if text-input-group--IsDisabled}}
aria-label="Disabled text input group example"
Copy link
Contributor

Choose a reason for hiding this comment

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

@jessiehuff can you confirm whether we need an aria-label on the outer container or just on the text input inside? I'm assuming the text input since this is designed to mimic the existing TextInput component.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll go ahead and move this label to just the input itself.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree, the aria-label makes the most sense on the text input like the TextInput component so that when the user gets to the input, it hears the label. That's where the screen reader would expect to interact with it. :)

@nicolethoen nicolethoen added this to the 2021.15 milestone Nov 2, 2021
- added handlebars whitespace removal tilde
- removed tabindex
- moved aria-label to only the text input itself
- removed pf-m-disabled border color setting
- added automatic value input when hbs template IsDisabled
- added contect to example id
Copy link
Member

@mcarrano mcarrano left a comment

Choose a reason for hiding this comment

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

@wise-king-sullyman the styling looks fine. But in comparing with https://www.patternfly.org/v4/components/text-input#disabled I notice that the standard disabled text field also has a cursor change, but the text input group does not.

@wise-king-sullyman
Copy link
Contributor Author

@mcarrano I had originally used cursor: not-allowed on this component to copy the disabled experience you're referring to from text-input, but @mcoker suggested that I instead use pointer-events: none so that any interaction with any items inside of the disabled text-input-group would be prevented.

I can change back to using cursor: not-allowed to enable the cursor change, but this will exclude me from being able to use pointer-events: none and require natively disabling any interactive elements (other than the input) passed into the text-input-group when setting it as disabled.

Button and Dropdown are a couple of examples where the cursor does not change when disabled.

Ultimately this comes down to a decision between making things simpler from a developer perspective, or nicer from a user perspective. I'm happy to go in either direction you prefer but thought you may want this additional context.

Copy link
Member

@mcarrano mcarrano left a comment

Choose a reason for hiding this comment

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

@wise-king-sullyman Thanks for the explanation about why we should not change the cursor when the text input group is disabled. I agree to keep it as is.

Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

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

Looks awesome! Just a couple of nits and it's ready to go.

- reduced text input template IsDisabled conditional tests from two down
to one
- moved disabled border vars to top of block
…erate lines

Co-authored-by: Michael Coker <35148959+mcoker@users.noreply.github.com>
Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

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

Fantastic!!! 🏆

@mcoker mcoker changed the title feat(TextInputGroup): add disabled styling feat(TextInputGroup): added disabled styling Nov 3, 2021
@mcoker mcoker merged commit 9f8b5ab into patternfly:main Nov 3, 2021
@wise-king-sullyman wise-king-sullyman deleted the text-input-group-disabled-styling branch November 3, 2021 20:44
@patternfly-build
Copy link

🎉 This PR is included in version 4.153.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

Add disabled styling to text-input-group
6 participants