mui / base-ui

Base UI is an open-source library of accessible, unstyled UI components for React.
https://mui.com/base-ui/
MIT License
269 stars 45 forks source link

[field] Label doesn't blur unlinked input on mouse down #586

Open oliviertassinari opened 1 month ago

oliviertassinari commented 1 month ago

Steps to reproduce

Steps:

  1. https://deploy-preview-477--base-ui.netlify.app/base-ui/react-field/#controlled-validity / https://master--base-ui.netlify.app/components/react-field/#realtime-and-async-validation

https://github.com/user-attachments/assets/88333bd0-b586-4350-a9ed-edfac5b687a4

Current behavior

Doesn't blur on mouse down

Expected behavior

Should blue on mouse down

https://github.com/user-attachments/assets/035a2e87-39b6-4200-8d85-e360cc0e91a6

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label

Context

I noticed this on #477. It got me a bit confused at first, I wasn't sure I clicked right when I didn't saw the input blurred, or it made me feel a bit like the UI is unresponsive.

Your environment

npx @mui/envinfo ``` Don't forget to mention which browser you used. Output from `npx @mui/envinfo` goes here. ```

Search keywords: -

atomiks commented 1 month ago

I much prefer that it doesn't blur the label's own/linked input, which always felt strange to me. However I guess unrelated/unliked ones should still blur

oliviertassinari commented 1 month ago

I guess unrelated/unliked ones should still blur

💯

I much prefer that it doesn't blur the label's own/linked input, which always felt strange to me.

Tricky, it feels like the UI is lagging if I don't see the input blur when I mouse down on something else.

https://mui.com/material-ui/react-text-field/#basic-textfield feels right:

https://github.com/user-attachments/assets/ee434023-de91-4b8e-8dcf-66bd0e4c2061