Skip to content

Commit

Permalink
fix: remove overflowing of select dropdown inside modal
Browse files Browse the repository at this point in the history
  • Loading branch information
wuda-io committed Feb 24, 2025
1 parent a6bea3d commit a28822c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
11 changes: 9 additions & 2 deletions sass/components/_modal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
--modal-border-radius: 28px;
--modal-padding: 24px;
--modal-padding-bottom: 16px;
--modal-background-color: color-mix(in srgb, var(--md-sys-color-surface), var(--md-sys-color-surface-tint) 17%);

@extend .z-depth-5;
border: none;
Expand All @@ -13,7 +14,7 @@
width: 55%;
border-radius: var(--modal-border-radius);
will-change: top, opacity;
background-color: color-mix(in srgb, var(--md-sys-color-surface), var(--md-sys-color-surface-tint) 17%);
background-color: var(--modal-background-color);

// Dialog open
&[open] {
Expand All @@ -34,16 +35,22 @@
padding: var(--modal-padding);
padding-bottom: var(--modal-padding-bottom);
flex-shrink: 0;
position: sticky;
top: 0;
background-color: var(--modal-background-color);
}
.modal-content {
padding: 0 var(--modal-padding);
overflow-y: auto;
//overflow-y: auto; // causes select dropdown fail
}
.modal-footer {
border-radius: 0 0 var(--modal-border-radius) var(--modal-border-radius);
padding: var(--modal-padding);
text-align: right;
flex-shrink: 0;
position: sticky;
bottom: 0;
background-color: var(--modal-background-color);
}

.modal-close {
Expand Down
3 changes: 2 additions & 1 deletion src/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class FormSelect extends Component<FormSelectOptions> {
};

this.isMultiple = this.el.multiple;
this.nativeTabIndex = (this.el.tabIndex ?? -1);
this.nativeTabIndex = this.el.tabIndex ?? -1;
this.el.tabIndex = -1;
this._values = [];
this._setupDropdown();
Expand Down Expand Up @@ -204,6 +204,7 @@ export class FormSelect extends Component<FormSelectOptions> {
// Create dropdown
this.dropdownOptions = document.createElement('ul');
this.dropdownOptions.id = `select-options-${Utils.guid()}`;
this.dropdownOptions.setAttribute('popover', 'auto');
this.dropdownOptions.classList.add('dropdown-content', 'select-dropdown');
this.dropdownOptions.setAttribute('role', 'listbox');
this.dropdownOptions.ariaMultiSelectable = this.isMultiple.toString();
Expand Down

0 comments on commit a28822c

Please sign in to comment.