Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Extraneous scrollbar when selecting text field #31031

Open
2 tasks done
ehrenMSFT opened this issue Apr 11, 2024 · 21 comments · May be fixed by #31314
Open
2 tasks done

[Bug]: Extraneous scrollbar when selecting text field #31031

ehrenMSFT opened this issue Apr 11, 2024 · 21 comments · May be fixed by #31314
Assignees
Labels
Component: TextField Fluent UI react (v8) Issues about @fluentui/react (v8)

Comments

@ehrenMSFT
Copy link

ehrenMSFT commented Apr 11, 2024

Library

React / v8 (@fluentui/react)

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (24) x64 12th Gen Intel(R) Core(TM) i9-12900K
    Memory: 29.93 GB / 63.71 GB
  Browsers:
    Edge: Chromium (123.0.2420.81)
    Internet Explorer: 11.0.22621.1

Are you reporting Accessibility issue?

no

Reproduction

https://codepen.io/EhrenMSFT/pen/gOyKxeO

Bug Description

  • Run the sample app
  • Set your display zoom to 150%
  • Click in the text field

Actual Behavior

Text field is focused, but an unexpected horizontal scrollbar also appears down below.

Expected Behavior

Text field is focused.

Logs

No response

Requested priority

Normal

Products/sites affected

Microsoft Power Query

Are you willing to submit a PR to fix?

no

Validations

  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • The provided reproduction is a minimal reproducible example of the bug.
@github-actions github-actions bot added Fluent UI react (v8) Issues about @fluentui/react (v8) Needs: Triage 🔍 labels Apr 11, 2024
@sopranopillow
Copy link
Contributor

I am not able to repro this, could you provide the size of the screen in pixels?

@ehrenMSFT
Copy link
Author

Sure. It's 1920 x 1080.

image

@ehrenMSFT
Copy link
Author

Also note that the scrollbar appears down below.

image

@sopranopillow
Copy link
Contributor

I'm still not able to repro it. I suspected it could be some invisible border or something that appears on focus, but setting the width exactly to before overflowing content and focusing on the textfield doesn't trigger the scrollbar. Could you recreate it maybe setting a div around it that allows scrolling?

@Narvalex
Copy link

I used the Edge Browser zoom to 150% and it appears indeed at the bottom. It disapears when you change zoom to something less, like 125%.

@ehrenMSFT
Copy link
Author

I'm still not able to repro it. I suspected it could be some invisible border or something that appears on focus, but setting the width exactly to before overflowing content and focusing on the textfield doesn't trigger the scrollbar. Could you recreate it maybe setting a div around it that allows scrolling?

If you're having trouble reproing, maybe try a higher zoom level (such as 200%).

Does your monitor have a native resolution of 1920 x 1080? The issue seems related to fractional pixels, so that might be a required part of the repro.

Regarding setting a div around it, I'm not sure exactly what you're asking for.

@sopranopillow
Copy link
Contributor

Okay I see it reproing. It looks like my guess was correct, but this happens due to this overflow style:
image

When the textfield is unfocused we have a width of 398.67, but when we focus we add an outline that's 2px wide causing this:
image
and therefore, overflowing the root where the style is applied.

@ehrenMSFT
Copy link
Author

Glad you were able to repro. Just to clarify: do you agree this a bug when hosting the control inside a fixed-size container? Or do you consider this by design?

@ehrenMSFT
Copy link
Author

@sopranopillow Just checking in again on my question above. Thanks!

@sopranopillow
Copy link
Contributor

Hi sorry for the wait, I actually consider this by design. The root is meant to take the size of the input, so no overflow logic should be added. We do this in v9 as well. If the goal is to let the input resize based on scroll height, that should be dealt through JS like (react-textarea-autosize)[https://github.com/Andarist/react-textarea-autosize) does.

@ehrenMSFT
Copy link
Author

@sopranopillow Thanks for the clarification. While investigating how to resolve this in our codebase, I realized that my repro was not consistent with what we're actually doing. We aren't setting overflow:auto on the root of the TextField. Instead, we're doing that on a div that contains the TextField.

I've updated my codepen with a new, more accurate repro that doesn't depend on any custom styling of the TextField.

If a TextField is contained in a fixed-size, scrollable container, it doesn't seem like the TextField should change its size just because it’s focused.

Can you take a look?

@ehrenMSFT
Copy link
Author

Hey @sopranopillow. Just following up. Do you consider the new repro I posted a bug, or by design? Thanks!

@sopranopillow
Copy link
Contributor

hi @ehrenMSFT, I'm not able to repro this one. I'm following the same steps as before and just to confirm I'm doing it right, I'm doing this:

  • zoom to 150%
  • make sure the window width is exactly the same as the window input (tried also making it little less and little more)
  • focus on the input

maybe a video of the repro would help.

@ehrenMSFT
Copy link
Author

@sopranopillow Here's a video repro:
https://github.com/microsoft/fluentui/assets/29806264/2ebbb8f7-7c31-476b-8778-936714389877

My steps were:

  • Set the Windows "Scale and layout" zoom level to 150%.
  • Leave my browser window width maximized.
  • Focus the text field.

@sopranopillow
Copy link
Contributor

Hi @ehrenMSFT, I've tried to repro this and got some of the other contributors to try it as well and we weren't able to repro it. FWIW I do think this would be a by design case.

@ehrenMSFT
Copy link
Author

@sopranopillow Ok, thanks for checking. Regarding this being by design, what is the recommendation for hosting these controls inside a fixed-size, scrollable container, since their size changes when they're focused?

We're getting bugs filed against our application, due to customers using various zoom levels that cause these scrollbars to appear.

@smhigley
Copy link
Contributor

smhigley commented May 8, 2024

I was able to repro the issue! For me, it happened on Edge on Windows at 175% zoom. The cause was Edge calculating the ::after pseudo-element's width as 0.29px larger than the root node 🤦🏻‍♀️.

I'm pushing a fix that adds overflow: hidden to the element with the ::after focus style.

@ehrenMSFT
Copy link
Author

@smhigley Awesome! Thanks for fixing it.

Because this issue is marked as by design and has not had activity for over 3 days, we're automatically closing it for house-keeping purposes.

@ehrenMSFT
Copy link
Author

I don't think this is considered By Design anymore. There's an open PR out that's intended to fix it.

@ehrenMSFT
Copy link
Author

Hi @smhigley. Just curious what the status of the fix is. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: TextField Fluent UI react (v8) Issues about @fluentui/react (v8)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants