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]: Clicking on InfoLabel within a PromptInput scrolls the page up to the top with popover open #33746

Open
2 tasks done
FarhanMRahman opened this issue Jan 29, 2025 · 2 comments

Comments

@FarhanMRahman
Copy link

Component

InfoLabel

Package version

9.49.2

React version

18.3.0

Environment

System:
  OS: Windows 11 10.0.26100
  CPU: (16) x64 AMD EPYC 7763 64-Core Processor
  Memory: 32.51 GB / 63.95 GB
Browsers:
  Edge: Chromium (131.0.2903.99)

Current Behavior

Clicking on InfoLabel within a PromptInput scrolls the page up to the top with popover open. Popover (what's used in InfoButton) auto focuses when opened. This is done through a useEffect, but the positioning API allows repositioning many times per render, so that mismatch plus focusing right away on the first focusable element of the popover causes the jump.

Disabling autofocus and focusing through a callback ref works as a workaround, but using positioning: fixed does not. Here's the workaround:

Image

Here is the current behavior if you click on an InfoLabel to open the popover within a PrompInput:

Image

Expected Behavior

The InfoLabel click should not jump/scroll up the page to the top when used within a PromptInput and when it shows a popover upon click. It should simply open up the popover and stay there.

Reproduction

https://stackblitz.com/run?file=src%2Fexample.tsx

Steps to reproduce

  1. Add a PromptInput and pass an InfoLabel in the actions prop so it shows up within the PromptInput box
  2. Click on the InfoLabel button to show the popover surface
  3. It should jump or scroll the page up swiftly to the top of the page

Here is the repro demo:

Image

Are you reporting an Accessibility issue?

no

Suggested severity

Medium - Has workaround

Products/sites affected

loop.microsoft.com

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.
@dmytrokirpa
Copy link
Contributor

@FarhanMRahman Could you please include the standalone reproduction on Stackblitz/CodeSandbox?

Thank you!

@FarhanMRahman
Copy link
Author

Spoke with dmytrokirpa separately and gave him more context. The team will follow up with me with more resource later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants