Skip to content

Commit

Permalink
feat(select): expose menu and *-field CSS shadow parts
Browse files Browse the repository at this point in the history
fixes #4291

PiperOrigin-RevId: 546330782
  • Loading branch information
Elliott Marquez authored and copybara-github committed Jul 11, 2023
1 parent 86aba33 commit 7206ec9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions select/lib/filled-select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ import {Select} from './select.js';
// tslint:disable-next-line:enforce-comments-on-exported-symbols
export abstract class FilledSelect extends Select {
protected readonly fieldTag = literal`md-filled-field`;
protected readonly fieldPartName = 'filled-field';
}
1 change: 1 addition & 0 deletions select/lib/outlined-select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ import {Select} from './select.js';
// tslint:disable-next-line:enforce-comments-on-exported-symbols
export abstract class OutlinedSelect extends Select {
protected readonly fieldTag = literal`md-outlined-field`;
protected readonly fieldPartName = 'outlined-field';
}
3 changes: 3 additions & 0 deletions select/lib/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ export abstract class Select extends LitElement {
}

protected abstract readonly fieldTag: StaticValue;
protected abstract readonly fieldPartName: string;

/**
* Used for initializing select when the user sets the `value` directly.
Expand Down Expand Up @@ -195,6 +196,7 @@ export abstract class Select extends LitElement {
<${this.fieldTag}
aria-haspopup="listbox"
role="combobox"
part=${this.fieldPartName}
tabindex=${this.disabled ? '-1' : '0'}
aria-expanded=${this.open ? 'true' : 'false'}
class="field"
Expand Down Expand Up @@ -256,6 +258,7 @@ export abstract class Select extends LitElement {
listTabIndex="-1"
type="listbox"
stay-open-on-focusout
part="menu"
.anchor=${this.field}
.open=${this.open}
.quick=${this.quick}
Expand Down

0 comments on commit 7206ec9

Please sign in to comment.