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

SegmentedControl displays incorrect value after opening or collapsing AppShell Navbar #6527

Closed
1 of 2 tasks
yorkeJohn opened this issue Jul 15, 2024 · 5 comments · Fixed by #6622
Closed
1 of 2 tasks
Labels
help wanted Contributions from community are welcome

Comments

@yorkeJohn
Copy link
Contributor

yorkeJohn commented Jul 15, 2024

Dependencies check up

  • I have verified that I use latest version of all @mantine/* packages

What version of @mantine/* packages do you have in package.json?

7.11.2

What package has an issue?

@mantine/core

What framework do you use?

Next.js

In which browsers you can reproduce the issue?

All

Describe the bug

When a non-default option is selected in SegmentedControl, the incorrect value is displayed in SegmentedControl when the collapsed state of AppShell.Navbar changes. The actual state does not change, just the rendered value.

Steps to reproduce

  1. See the attached CodeSandbox
  2. Select 'Option 2' in the SegmentedControl
  3. Open the AppShell.Navbar using the burger icon
  4. Observe that the incorrect value is displayed

If possible, include a link to a codesandbox with a minimal reproduction

https://codesandbox.io/p/sandbox/mantine-react-template-forked-lg4dq7

Possible fix

No response

Self-service

  • I would be willing to implement a fix for this issue
@ayovev
Copy link
Contributor

ayovev commented Jul 16, 2024

Confirmed that this is also happening in my application and the Code Sandbox demonstrates the issue well 👍

@rtivital rtivital added the help wanted Contributions from community are welcome label Jul 16, 2024
@michaelperros
Copy link
Contributor

michaelperros commented Aug 1, 2024

I'd like to work on this issue.

The problem seems to be related to this line of code.

The opening of the AppShell Navbar changes the parent and triggers the useEffect in use-floating-indicator that calls the updatePositionWithoutAnimation() which causes the bug.

@rtivital
Copy link
Member

rtivital commented Aug 1, 2024

You are welcome to send a pr

@michaelperros
Copy link
Contributor

Please see #6622

@ayovev
Copy link
Contributor

ayovev commented Aug 2, 2024

@michaelperros Thank you for putting that PR together! I was just in the middle of butting heads with this bug in my app and was about to dig in. If @rtivital is happy with it, it would be great to get this fix into the next minor/patch release 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Contributions from community are welcome
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants