Skip to content

Commit

Permalink
[Select][TextField] Fix screen reader from saying &ZeroWidthSpace (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
arishoham authored Dec 4, 2024
1 parent 1262b2a commit 6c6cb7e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
4 changes: 3 additions & 1 deletion packages/mui-base/src/Select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,9 @@ const Select = React.forwardRef(function Select<
{renderValue(selectedOptionsMetadata) ?? placeholder ?? (
// fall back to a zero-width space to prevent layout shift
// from https://github.com/mui/material-ui/pull/24563
<span className="notranslate">&#8203;</span>
<span className="notranslate" aria-hidden>
&#8203;
</span>
)}
</Button>
{buttonDefined && (
Expand Down
4 changes: 3 additions & 1 deletion packages/mui-material/src/FormHelperText/FormHelperText.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ const FormHelperText = React.forwardRef(function FormHelperText(inProps, ref) {
>
{children === ' ' ? (
// notranslate needed while Google Translate will not fix zero-width space issue
<span className="notranslate">&#8203;</span>
<span className="notranslate" aria-hidden>
&#8203;
</span>
) : (
children
)}
Expand Down
4 changes: 3 additions & 1 deletion packages/mui-material/src/InputAdornment/InputAdornment.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ const InputAdornment = React.forwardRef(function InputAdornment(inProps, ref) {
{/* To have the correct vertical alignment baseline */}
{position === 'start' ? (
/* notranslate needed while Google Translate will not fix zero-width space issue */
<span className="notranslate">&#8203;</span>
<span className="notranslate" aria-hidden>
&#8203;
</span>
) : null}
{children}
</React.Fragment>
Expand Down
4 changes: 3 additions & 1 deletion packages/mui-material/src/OutlinedInput/NotchedOutline.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ export default function NotchedOutline(props) {
<span>{label}</span>
) : (
// notranslate needed while Google Translate will not fix zero-width space issue
<span className="notranslate">&#8203;</span>
<span className="notranslate" aria-hidden>
&#8203;
</span>
)}
</NotchedOutlineLegend>
</NotchedOutlineRoot>
Expand Down
4 changes: 3 additions & 1 deletion packages/mui-material/src/Select/SelectInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,9 @@ const SelectInput = React.forwardRef(function SelectInput(props, ref) {
{/* So the vertical align positioning algorithm kicks in. */}
{isEmpty(display) ? (
// notranslate needed while Google Translate will not fix zero-width space issue
<span className="notranslate">&#8203;</span>
<span className="notranslate" aria-hidden>
&#8203;
</span>
) : (
display
)}
Expand Down

0 comments on commit 6c6cb7e

Please sign in to comment.