Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LS25001091 - fix: AML focus on first element #2559

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/ketchup/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3202,6 +3202,10 @@ export namespace Components {
"selectable": boolean;
"setBlur": () => Promise<void>;
"setFocus": () => Promise<void>;
/**
* Focuses the first element of the list.
*/
"setFocusOnFirstEl": () => Promise<void>;
/**
* Sets the props to the component.
* @param props - Object containing props that will be set to the component.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ export class KupAutocomplete {
const topOffset = hasError || hasAlert ? -20 : 0;
this.#textfieldWrapper.classList.add('toggled');
this.#listEl.menuVisible = true;
this.#listEl.setFocusOnFirstEl();
const elStyle = this.#listEl.style;
elStyle.height = 'auto';
elStyle.minWidth = this.#textfieldWrapper.clientWidth + 'px';
Expand Down
8 changes: 8 additions & 0 deletions packages/ketchup/src/components/kup-list/kup-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,14 @@ export class KupList {
/* P u b l i c M e t h o d s */
/*-------------------------------------------------*/

/**
* Focuses the first element of the list.
*/
@Method()
async setFocusOnFirstEl() {
this.focused = 0;
}

/**
* Focuses the next element of the list.
*/
Expand Down
10 changes: 10 additions & 0 deletions packages/ketchup/src/components/kup-list/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,16 @@ Type: `Promise<void>`



### `setFocusOnFirstEl() => Promise<void>`

Focuses the first element of the list.

#### Returns

Type: `Promise<void>`



### `setProps(props: GenericObject) => Promise<void>`

Sets the props to the component.
Expand Down