Skip to content

Commit

Permalink
fix: sets action-menu quiet to false by default, fixes #3040
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamind committed Mar 17, 2023
1 parent f6a7ece commit 1bf6589
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
3 changes: 1 addition & 2 deletions packages/action-menu/src/ActionMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class ActionMenu extends ObserveSlotText(PickerBase, 'label') {
protected override render(): TemplateResult {
return html`
<sp-action-button
quiet
?quiet=${this.quiet}
?selected=${this.open}
aria-haspopup="true"
aria-controls="popover"
Expand All @@ -85,7 +85,6 @@ export class ActionMenu extends ObserveSlotText(PickerBase, 'label') {
if (changedProperties.has('invalid')) {
this.invalid = false;
}
this.quiet = true;
super.update(changedProperties);
}
}
11 changes: 8 additions & 3 deletions packages/picker/src/Picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,6 @@ export class PickerBase extends SizedMixin(Focusable) {
popover.style.setProperty('--swc-menu-width', `100%`);
return;
}
if (this.quiet) return;
// only use `this.offsetWidth` when Standard variant
popover.style.setProperty('min-width', `${this.offsetWidth}px`);
}

private async closeMenu(): Promise<void> {
Expand Down Expand Up @@ -637,6 +634,14 @@ export class Picker extends PickerBase {
return [pickerStyles, chevronStyles];
}

protected override sizePopover(popover: HTMLElement): void {
super.sizePopover(popover);

if (this.quiet) return;
// only use `this.offsetWidth` when Standard variant
popover.style.setProperty('min-width', `${this.offsetWidth}px`);
}

protected override onKeydown = (event: KeyboardEvent): void => {
const { code } = event;
this.focused = true;
Expand Down

0 comments on commit 1bf6589

Please sign in to comment.