Repository navigation
Conversation
…iling icons InputBase defaulted its type to "text" and passed it on explicitly, which overrode the type set on the field around it. `<TextField type="password">` with a plain `<InputBase />` rendered the password as readable text with no visibility toggle, and `type="email"` was dropped the same way. InputBase now takes the field's type when it has none of its own. Long text also ran underneath two of the controls at the end of the input: - The password toggle, which had no padding reserved for it. - The invalid icon, when the invalid state came from the field rather than the `isInvalid` prop of InputBase, as it does for `<Input isInvalid>`. The icon is shown with CSS, so its padding is now applied by the same state. The password toggle is labelled "Show password" and reports `aria-pressed`, so assistive technology can tell whether the password is shown.
30 tasks
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Three fixes to
InputBaseincomponents/base/input/input.tsx.The type set on the field is no longer dropped.
InputBasedefaultedtypeto"text"and passed it on explicitly, which overrode the type set on the field around it. This rendered the password as readable text, with no visibility toggle:type="email"and the other types were dropped the same way.InputBasenow takes the field's type when it has none of its own. Its owntypestill wins, and the default is still"text".Long text no longer runs underneath the controls at the end of the input.
isInvalidprop ofInputBase, which is the case for<Input isInvalid>without atooltip. The icon is shown with CSS (group-invalid/input), so its padding is now applied by the same state and the two cannot drift apart.The password toggle reports its state. It is labelled "Show password" and sets
aria-pressed, so assistive technology can tell whether the password is shown. Before, it was announced as "Toggle password visibility" in both states.Two things to be aware of:
aria-label, "Toggle password visibility", needs the new one.InputBaseinside a React AriaSearchFieldnow renderstype="search"(dropdown-search-simpleanddropdown-search-advanced).globals.cssalready hides the native clear button, and the dropdown renders pixel-identical before and after in Chromium.No new props or dependencies.
Related issues
Related to #228, which reports the password text overlap.
Type of change
Testing
bun run testchecks pass (type-check, ESLint, Prettier).mainand pass with this change:InputBasekeeps the type of its field (password,email,search), its owntypewins, and the default istext.aria-pressedfollows the password's visibility.sm,mdandlg, the input's text area ends before the password toggle (hidden and revealed) and before the invalid icon, whether the invalid state comes fromInput,TextFieldorInputBase.Manual testing steps
<TextField type="password"><Label>Password</Label><InputBase /></TextField>and type into it. The value is masked and the eye toggle is shown.<Input type="password" defaultValue="a-very-long-password-that-does-not-fit" />in a narrow container and press the toggle. The text stops before the icon.<Input isInvalid defaultValue="a-very-long-value-that-does-not-fit" />in a narrow container. The text stops before the error icon.