Skip to content

Commit

Permalink
feat: add skipRestoreFocus property to list item for menus
Browse files Browse the repository at this point in the history
  • Loading branch information
hperrin committed Nov 15, 2021
1 parent fc81366 commit 58b98e0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/list/Item.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
? { 'aria-checked': input && input.checked ? 'true' : 'false' }
: {}}
{...!nav ? { 'aria-disabled': disabled ? 'true' : 'false' } : {}}
data-menu-item-skip-restore-focus={skipRestoreFocus || undefined}
{tabindex}
on:click={action}
on:keydown={handleKeydown}
Expand Down Expand Up @@ -102,6 +103,7 @@
setContext('SMUI:list:item:role', undefined);
export let selected = false;
export let disabled = false;
export let skipRestoreFocus = false;
let tabindexProp: UninitializedValue | number = uninitializedValue;
export { tabindexProp as tabindex };
export let inputId = 'SMUI-form-field-list-' + counter++;
Expand Down
1 change: 1 addition & 0 deletions packages/list/Item.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export declare class ItemComponentDev<
| 'role'
| 'selected'
| 'disabled'
| 'skipRestoreFocus'
| 'inputId'
| 'href'
| 'component'
Expand Down
4 changes: 4 additions & 0 deletions packages/menu-surface/MenuSurface.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,10 @@
return instance.setIsHoisted(isHoisted);
}
export function isFixed() {
return instance.isFixed();
}
export function getElement() {
return element;
}
Expand Down

0 comments on commit 58b98e0

Please sign in to comment.