From 4780aeb10f9aa74f483307960e110dcb68fecea4 Mon Sep 17 00:00:00 2001 From: JiYeon <73057489+appleSimple@users.noreply.github.com> Date: Thu, 27 Jun 2024 04:41:44 +0900 Subject: [PATCH] [material-ui][Text Field] when click password visibility button, text caret position change to very front. (#42595) --- .../material/components/text-fields/InputAdornments.js | 7 +++++++ .../material/components/text-fields/InputAdornments.tsx | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/docs/data/material/components/text-fields/InputAdornments.js b/docs/data/material/components/text-fields/InputAdornments.js index 39a5c219e43d2e..4176586ca9e943 100644 --- a/docs/data/material/components/text-fields/InputAdornments.js +++ b/docs/data/material/components/text-fields/InputAdornments.js @@ -21,6 +21,10 @@ export default function InputAdornments() { event.preventDefault(); }; + const handleMouseUpPassword = (event) => { + event.preventDefault(); + }; + return (
@@ -56,6 +60,7 @@ export default function InputAdornments() { aria-label="toggle password visibility" onClick={handleClickShowPassword} onMouseDown={handleMouseDownPassword} + onMouseUp={handleMouseUpPassword} edge="end" > {showPassword ? : } @@ -108,6 +113,7 @@ export default function InputAdornments() { aria-label="toggle password visibility" onClick={handleClickShowPassword} onMouseDown={handleMouseDownPassword} + onMouseUp={handleMouseUpPassword} edge="end" > {showPassword ? : } @@ -158,6 +164,7 @@ export default function InputAdornments() { aria-label="toggle password visibility" onClick={handleClickShowPassword} onMouseDown={handleMouseDownPassword} + onMouseUp={handleMouseUpPassword} > {showPassword ? : } diff --git a/docs/data/material/components/text-fields/InputAdornments.tsx b/docs/data/material/components/text-fields/InputAdornments.tsx index a347354809a2fc..661945ed50b13f 100644 --- a/docs/data/material/components/text-fields/InputAdornments.tsx +++ b/docs/data/material/components/text-fields/InputAdornments.tsx @@ -21,6 +21,10 @@ export default function InputAdornments() { event.preventDefault(); }; + const handleMouseUpPassword = (event: React.MouseEvent) => { + event.preventDefault(); + }; + return (
@@ -56,6 +60,7 @@ export default function InputAdornments() { aria-label="toggle password visibility" onClick={handleClickShowPassword} onMouseDown={handleMouseDownPassword} + onMouseUp={handleMouseUpPassword} edge="end" > {showPassword ? : } @@ -108,6 +113,7 @@ export default function InputAdornments() { aria-label="toggle password visibility" onClick={handleClickShowPassword} onMouseDown={handleMouseDownPassword} + onMouseUp={handleMouseUpPassword} edge="end" > {showPassword ? : } @@ -158,6 +164,7 @@ export default function InputAdornments() { aria-label="toggle password visibility" onClick={handleClickShowPassword} onMouseDown={handleMouseDownPassword} + onMouseUp={handleMouseUpPassword} > {showPassword ? : }