Skip to content
Open
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: 2 additions & 2 deletions packages/main/cypress/specs/ColorPalettePopover.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ describe("Color Popover Palette arrow keys navigation", () => {
});

describe("Color Popover Palette Home and End keyboard navigation", () => {
it.skip("should navigate with Home/End when showDefaultColor is set", () => {
it("should navigate with Home/End when showDefaultColor is set", () => {
cy.mount(
<SimplePalettePopover showDefaultColor={true} />
);
Expand Down Expand Up @@ -638,7 +638,7 @@ describe("Color Popover Palette Home and End keyboard navigation", () => {
.should("have.attr", "aria-label", "More Colors...");
});

it.skip("should navigate with Home/End when showDefaultColor & showMoreColors are set", () => {
it("should navigate with Home/End when showDefaultColor & showMoreColors are set", () => {
cy.mount(
<SimplePalettePopover showDefaultColor={true} showMoreColors={true} />
);
Expand Down
18 changes: 14 additions & 4 deletions packages/main/src/ColorPalette.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";

Check failure on line 1 in packages/main/src/ColorPalette.ts

View workflow job for this annotation

GitHub Actions / check

'@ui5/webcomponents-base/dist/UI5Element.js' imported multiple times
import { instanceOfUI5Element } from "@ui5/webcomponents-base/dist/UI5Element.js";

Check failure on line 2 in packages/main/src/ColorPalette.ts

View workflow job for this annotation

GitHub Actions / check

'@ui5/webcomponents-base/dist/UI5Element.js' imported multiple times

Check failure on line 2 in packages/main/src/ColorPalette.ts

View workflow job for this annotation

GitHub Actions / check

'instanceOfUI5Element' is defined but never used
import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
import property from "@ui5/webcomponents-base/dist/decorators/property.js";
import slot from "@ui5/webcomponents-base/dist/decorators/slot.js";
Expand Down Expand Up @@ -706,8 +707,11 @@
*/
_focusDefaultColor(): boolean {
if (this.showDefaultColor && this._defaultColorButton) {
this._defaultColorButton.focus();
return true;
const focusDomRef = this._defaultColorButton.getFocusDomRef();
if (focusDomRef) {
focusDomRef.focus();
return true;
}
}
return false;
}
Expand All @@ -718,8 +722,11 @@
*/
_focusMoreColors(): boolean {
if (this.showMoreColors && this._moreColorsButton) {
this._moreColorsButton.focus();
return true;
const focusDomRef = this._moreColorsButton.getFocusDomRef();
if (focusDomRef) {
focusDomRef.focus();
return true;
}
}
return false;
}
Expand Down Expand Up @@ -800,7 +807,10 @@

focusColorElement(element: ColorPaletteNavigationItem, itemNavigation: ItemNavigation) {
itemNavigation.setCurrentItem(element);
// Use 10ms delay to ensure the re-render from forcedTabIndex property change completes
// setTimeout(() => {
itemNavigation._focusCurrentItem();
// }, 10);
}

onColorPickerChange(e: Event) {
Expand Down
1 change: 1 addition & 0 deletions packages/main/src/ColorPaletteItemTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export default function ColorPaletteItemTemplate(this: ColorPaletteItem) {
return (
<div
class="ui5-cp-item"
data-sap-focus-ref
tabindex={parseInt(this.forcedTabIndex)}
role="button"
aria-label={`${this.colorLabel} - ${this.index}: ${this.value}`}
Expand Down
Loading