Skip to content

Commit ebeddfb

Browse files
committed
Fix overflow when using custom width on web component
In the demo, the two right-aligned instances in the header, set a custom width like so: ``` header .tsmb-form, header typesense-minibar form { width: 30em; } ``` Which overrides the default: ``` .tsmb-form, typesense-minibar form { width: 20rem; max-width: 100%; ``` The problem is that, when using the new web component variant, this `max-width` is uneffective because that relates to the parent, and when using the HTML class, that works as expected, but when using the web component, the parent is our own element, `<typesense-minibar>`, which if it's in a default static postition, or flex box without special shrink handling, then the parent will default to 30rem to encompass the child, so the child limiting itself to 100% max-width of the parent is not meaningful. To fix this, set it on the `typesense-minibar` selector directly as well. This fixes an obvious bug in the demos when viewed on mobile or other narrow viewports. Without the fix, the form overflows and causes a scrollbar.
1 parent 34c3ac2 commit ebeddfb

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

typesense-minibar.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ typesense-minibar {
2424
--tsmb-color-primary30: #390f39;
2525
--tsmb-color-primary50: #9c3493;
2626
--tsmb-color-primary90: #fbdbfb;
27+
28+
max-width: 100%;
2729
}
2830

2931
.tsmb-form,

0 commit comments

Comments
 (0)