mui / mui/material-ui

[TextField] Safari scrolls to top on password field focus with "filled" and "standard" variants

Open
#44,396 5 comments 0 reactions 1 assignee View on GitHub

@siriwatknp is already working on this.

Since Nov 13, 2024.

browser: Safari scope: text field type: bug
Dominant language
JavaScript
Stars
99.1k
Forks
32.5k
Avg merge
2d 17h
Merged PRs (30d)
106

Description

Steps to reproduce

Link to live example: (required)

https://github.com/user-attachments/assets/90dcfa48-2617-45bd-80f2-4c0dca1a46f3

Steps to Reproduce:
1. Go to the TextField demo page on MUI’s website.
2. Scroll to any TextField with type="password" and set to the “filled” or “standard” variant.
3. Click on the password field in Safari (on iOS 17 or macOS).
4. Observe that the page briefly scrolls to the top of the viewport as Safari displays the password suggestion prompt.

Current behavior

In Safari, when focusing on a TextField with type="password" in either the “filled” or “standard” variant, the page flashes to the top as Safari’s password suggestion prompt appears. This behavior does not occur with the “outlined” variant.

Expected behavior

The page should remain stable and not scroll when the password field is focused, regardless of the variant in use.

Context

This issue affects the usability of forms with password fields in Safari by causing unexpected scrolling behavior. The issue appears to be related to Safari’s password suggestion feature, affecting both mobile and desktop Safari users.

Your environment
npx @mui/envinfo
 System:
    OS: macOS 14.6.1 / iOS 17
  Binaries:
    Node: 20.16.0
    npm: 10.8.1
  Browsers:
    Safari: 17.6 (macOS), iOS Safari (iOS 17)
  npmPackages:
    @mui/material: ^6.1.6
    react: ^18.2.0

Search keywords: TextField password scroll Safari, TextField password field Safari bug, Safari scroll to top password field, MUI TextField password variant issue

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.