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

Select has scroll x enabled for long values after upgrading #4177

Closed
ibenjelloun opened this issue May 2, 2023 · 8 comments · Fixed by #4296
Closed

Select has scroll x enabled for long values after upgrading #4177

ibenjelloun opened this issue May 2, 2023 · 8 comments · Fixed by #4296
Labels
help wanted Contributions from community are welcome

Comments

@ibenjelloun
Copy link

ibenjelloun commented May 2, 2023

What package has an issue

@mantine/core

Describe the bug

After upgrading from 5.10.5 to 6.0.10, the Select component bahavior changed for long values, an horizontal scroll bar is displayed instead of wrapping item content :

Observed :

image

Expected :

image

What version of @mantine/hooks page do you have in package.json?

6.0.10

If possible, please include a link to a codesandbox with the reproduced problem

https://stackblitz.com/edit/react-ts-1k2vpc?file=App.tsx

Do you know how to fix the issue

No

Are you willing to participate in fixing this issue and create a pull request with the fix

No

Possible fix

No response

@rtivital rtivital added the help wanted Contributions from community are welcome label May 2, 2023
@mustaphaboudouch
Copy link

I solved the issue, here is the solution : https://stackblitz.com/edit/react-ts-9cnamk?file=App.tsx

@ibenjelloun
Copy link
Author

I solved the issue, here is the solution : https://stackblitz.com/edit/react-ts-9cnamk?file=App.tsx

Hello @mustaphaboudouch, thank you for your suggestion, the behavior is better than the default but still not the same as the version 5, you can see the expected result in the issue description.

@ibenjelloun
Copy link
Author

Can go back to previous behavior with this style change :

const useStyles = createStyles(() => ({
  item: {
    whiteSpace: 'break-spaces',
  },
}));

https://stackblitz.com/edit/react-ts-z8tsan?file=App.tsx

@mustaphaboudouch
Copy link

Sorry, i didn't see the expected behavior, here is the solution : https://stackblitz.com/edit/react-ts-9cnamk?file=App.tsx

@ibenjelloun
Copy link
Author

Is the horizontal scroll supposed to be the default behavior ?

@mustaphaboudouch
Copy link

mustaphaboudouch commented May 3, 2023

Yes, because the select popover is wrapped in a scrollarea component 👇

Capture d’écran 2023-05-03 à 10 21 01

@ibenjelloun
Copy link
Author

Yes, because the select popover is wrapped in a scrollarea component 👇

Capture d’écran 2023-05-03 à 10 21 01

I understand that the horizontal scrollbar comes from the usage of ScrollArea, but do we really want this to be the default behavior ?
From my subjective point of view, this change is a regression and the default behavior should wrap text instead of adding an horizontal scrollbar.

@mustaphaboudouch
Copy link

I agree with you, but this is a rare case, because if you want the user to select between options with large text, I don't think select component is the best option , you can use a radio button or checkable custom items...

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.

3 participants