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

Override minimum left padding in ComboBox and InfoSelect popovers #811

Merged
merged 6 commits into from
Sep 1, 2023

Conversation

heisand
Copy link
Contributor

@heisand heisand commented Sep 1, 2023

Background

A negative margin was added to the popover due to that the ComboBox popover was displaced some pixels to the right in the app it was used after removing the overlay. The popover will in fact always be displaced to the right relative to the input field when there is less than 12 px padding to the left in the container. This is because the default minimum container padding is 12 px.

By adding a negative margin, it worked against its purpose for InfoSelect and ComboBox when there is enough left padding, causing the popover to be displaced the opposite way.

Solution

We can override the minimum padding by passing containerPadding: 0 to usePopover.

@heisand heisand requested review from idagyl, a team, selbekk, emildohlenhansen, cecilmkl and AnamaP and removed request for a team September 1, 2023 06:17
@changeset-bot
Copy link

changeset-bot bot commented Sep 1, 2023

🦋 Changeset detected

Latest commit: 29e323b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@vygruppen/spor-react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@heisand heisand changed the title Override minimum left padding in popovers in ComboBox and InfoSelect Override minimum left padding ComboBox and InfoSelect popovers Sep 1, 2023
@heisand heisand changed the title Override minimum left padding ComboBox and InfoSelect popovers Override minimum left padding in ComboBox and InfoSelect popovers Sep 1, 2023
Copy link
Contributor

@selbekk selbekk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

packages/spor-react/src/input/Popover.tsx Outdated Show resolved Hide resolved
@heisand heisand merged commit afebaf3 into main Sep 1, 2023
1 check passed
@heisand heisand deleted the fix-combobox-padding branch September 1, 2023 07:05
@heisand heisand restored the fix-combobox-padding branch September 1, 2023 12:12
@selbekk selbekk deleted the fix-combobox-padding branch September 7, 2023 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants