You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Carbon for IBM Products (or Carbon for IBM Cloud & Cognitive)
Legacy/CDAI
Legacy/Security
Detailed description
Describe in detail the issue you're having.
The onTogglePasswordVisibility handler is returning the exact element being clicked on rather than just the button or some other useful state object/prop.
The doc comment and return type for the prop seems to indicate it should just be button:
/**
* Callback function that is called whenever the toggle password visibility button is clicked
* @param evt Mouse event triggered by the password visibility `<button>`
* @returns {void}
*/
onTogglePasswordVisibility?: (
evt: React.MouseEvent<HTMLButtonElement>
) => void;
What happened instead?
Exact element clicked is returned (e.g. svg, path, button).
What would you like to see changed?
It's not clear what the utility of receiving any click event is here (What would a user do with this information?). Personally, I thought it would give me the ability to override the default behavior which simply toggles the input type. Perhaps receiving the current input type would be passed back. Example:
What package(s) are you using?
(This is a native Carbon component)
Detailed description
The
onTogglePasswordVisibility
handler is returning the exact element being clicked on rather than just the button or some other useful state object/prop.PasswordInput
packages/react/src/components/TextInput/PasswordInput.tsx
Expected to receive just the button element.
The doc comment and return type for the prop seems to indicate it should just be button:
Exact element clicked is returned (e.g. svg, path, button).
It's not clear what the utility of receiving any click event is here (What would a user do with this information?). Personally, I thought it would give me the ability to override the default behavior which simply toggles the input type. Perhaps receiving the current input type would be passed back. Example:
FF/Chrome
Carbon v11.48.0
Turbonomic
Steps to reproduce the issue/Reduced test case:
Add this line:
onTogglePasswordVisibility={(e) => console.log(e.target)} // <--- This line
to the
TogglePasswordVisibility
component in the story:packages/react/src/components/TextInput/TextInput.stories.js
Like so:
Check the console and click on various spots on the visibility toggle. Observe the behavior as shown in video below.
Additional information
Screen.Recording.2024-01-24.at.2.06.51.PM.mov
The text was updated successfully, but these errors were encountered: