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

2722 popover menu toggle variant menu items cause accessibility error #2907

Draft
wants to merge 31 commits into
base: v3.0.0/develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
56f0e71
fix(canary-web-components): fix for items displayed on brand color ba…
ad9242 Dec 18, 2024
709f84f
fix(web-components): fix for items displayed on brand color background
ad9242 Dec 18, 2024
2f7677b
fix(react): fix for items displayed on brand color background
ad9242 Dec 18, 2024
9c3032d
Merge pull request #2929 from mi6/theme-from-context-fix
ad9242 Dec 19, 2024
56ea863
fix(web-components): update icon colours for dark mode badge
GCHQ-Developer-530 Dec 19, 2024
de29bb5
chore(fonts): update fonts package to alpha versioning for v3
GCHQ-Developer-530 Dec 19, 2024
0e65b33
fix(react): update icon colours for dark mode badge
GCHQ-Developer-530 Dec 19, 2024
7858c74
Merge pull request #2941 from mi6/update-fonts-to-alpha-versioning
GCHQ-Developer-530 Dec 19, 2024
e2e8d5f
test(canary-web-components): fixes data-table unit tests
ad9242 Dec 19, 2024
3cf1a8e
fix: prevent mutation of ic-pagination-bar items per page options prop
dn55533 Dec 19, 2024
0167913
test(canary-react): adds visual test for action elements
ad9242 Dec 19, 2024
0887b01
Merge pull request #2948 from mi6/cherry-pick-prevent-mutation-of-ic-…
GCHQ-Developer-299 Dec 20, 2024
79c83c7
Merge pull request #2945 from mi6/v3-data-table-tests
ad9242 Dec 20, 2024
e11c078
docs(docs): docs changes
lz405 Dec 10, 2024
923c9b3
feat(web-components): dismiss label
gd2910 Dec 20, 2024
8d29200
test(react): chip tests
gd2910 Dec 20, 2024
34770e4
Merge pull request #2952 from mi6/cherry-pick/tooltip-dismiss-label
GCHQ-Developer-299 Dec 20, 2024
e4786e2
feat(web-components): Fix/able to select no options when select has e…
gd2910 Dec 18, 2024
d1b1292
test(react): cypress test
gd2910 Dec 19, 2024
ef8c749
feat(root): updates examples after ic-theme prop changes
ad9242 Dec 30, 2024
e662466
docs(canary-docs): updates to canary-docs package
ad9242 Dec 30, 2024
16319ba
docs(docs): updates to docs package
ad9242 Dec 30, 2024
620eba0
feat(canary-web-components): updates due to ic-theme components changes
ad9242 Dec 30, 2024
2c05af6
feat(web-components): changes to ic-theme
ad9242 Dec 30, 2024
701b3cc
feat(react): ic-theme component changes
ad9242 Dec 30, 2024
d05534a
Merge pull request #2958 from mi6/ic-theme-color-prop-rename
MI6-255 Jan 2, 2025
d6cfe91
Merge pull request #2870 from mi6/fix/select-no-options
GCHQ-Developer-847 Jan 2, 2025
0756606
Merge pull request #2942 from mi6/2910-ic-badge-dark-mode-info-varian…
GCHQ-Developer-847 Jan 2, 2025
4f553d5
chore(root): add script in package.json to run only React and web-com…
GCHQ-Developer-112 Dec 16, 2024
11eb2e3
fix(web-components): restructure toggle variant of ic-menu-item to fi…
GCHQ-Developer-112 Dec 16, 2024
3084bd5
fix(react): update Cypress tests following the restructure of the tog…
GCHQ-Developer-112 Dec 16, 2024
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
20 changes: 10 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,26 +293,26 @@ export class Component {

@Prop() status?: string;

@Event() icComponentThemeChange!: EventEmitter<{ mode: string }>;
@Event() icComponentBrandChange!: EventEmitter<{ mode: string }>;

@Listen("themeChange", { target: "document" })
themeChangeHandler(ev: CustomEvent): void {
this.theme = ev.detail.mode;
@Listen("brandChange", { target: "document" })
brandChangeHandler(ev: CustomEvent): void {
this.brand = ev.detail.mode;
}

@Method()
async updateLabel(label: string) {
this.label = label;
}

private theme: IcTheme;
private brand: IcBrand;

private updateStatus(status: string) {
this.status = status;
}

private clickHandler() {
this.icComponentThemeChange.emit({
this.icComponentBrandChange.emit({
mode: "dark"
});
}
Expand Down Expand Up @@ -370,9 +370,9 @@ it('tests receiving custom events', async () => {
html: `<ic-component label="foo"></ic-alert>`
});

await page.rootInstance.themeChangeHandler({ detail: { mode: "bar" } });
await page.rootInstance.brandChangeHandler({ detail: { mode: "bar" } });
await page.waitForChanges();
expect(page.rootInstance.theme).toBe("bar");
expect(page.rootInstance.brand).toBe("bar");
});

// Testing events emitted from the component
Expand All @@ -383,9 +383,9 @@ it('tests emitted events', async () => {
});

const callbackFn = jest.fn();
page.win.addEventListener('icComponentThemeChange', callbackFn);
page.win.addEventListener('icComponentBrandChange', callbackFn);

// clickHandler emits the icComponentThemeChange event
// clickHandler emits the icComponentBrandChange event
await page.rootInstance.clickHandler();
await page.waitForChanges();
expect(callbackFn).toHaveBeenCalled();
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"build:all": "npm run build && npm run build:canary",
"release-check": "lerna version --no-push --no-git-tag-version",
"storybook": "lerna run storybook --stream --parallel",
"storybook:core": "lerna run storybook --scope @ukic/web-components --scope @ukic/react --stream --parallel",
"storybook:canary": "lerna run storybook --scope=@ukic/canary-* --stream --parallel",
"build-storybook:web-components": "lerna run build-storybook --scope @ukic/web-components",
"build-storybook:react": "lerna run build-storybook --scope @ukic/react",
Expand Down
2 changes: 1 addition & 1 deletion packages/canary-docs/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@
"passive": false
},
{
"event": "themeChange",
"event": "brandChange",
"target": "document",
"capture": false,
"passive": false
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ describe("IcDataTables", () => {
cy.checkHydrated(DATA_TABLE_SELECTOR);
cy.wait(350).compareSnapshot({
name: "loading-options",
testThreshold: setThresholdBasedOnEnv(0.026),
testThreshold: setThresholdBasedOnEnv(0.029),
cypressScreenshotOptions: {
capture: "viewport",
},
Expand Down Expand Up @@ -1085,69 +1085,75 @@ describe("IcDataTables", () => {
sorted: "descending",
});
});
});

it("should render an element in the table cell if the data prop contains the actionElement key", () => {
mount(
<IcDataTable
columns={COLS}
data={ACTION_DATA_ELEMENTS}
caption="Data tables"
></IcDataTable>
);
cy.viewport(1024, 768);
it("should render an element in the table cell if the data prop contains the actionElement key", () => {
mount(
<IcDataTable
columns={COLS}
data={ACTION_DATA_ELEMENTS}
caption="Data tables"
></IcDataTable>
);

cy.checkHydrated(DATA_TABLE_SELECTOR);
cy.checkHydrated(DATA_TABLE_SELECTOR);

cy.findShadowEl(DATA_TABLE_SELECTOR, "td")
.eq(0)
.find("span")
.should(HAVE_CLASS, "action-element")
.find("ic-button")
.should("be.visible");
});
cy.findShadowEl(DATA_TABLE_SELECTOR, "td")
.eq(0)
.find("span")
.should(HAVE_CLASS, "action-element")
.find("ic-button")
.should("be.visible");

it("should not render an element in the table cell if the data prop does not contain the actionElement key", () => {
mount(
<IcDataTable
columns={COLS}
data={ACTION_DATA_ELEMENTS}
caption="Data tables"
></IcDataTable>
);
cy.viewport(1024, 768);
cy.checkA11yWithWait(undefined, 300);

cy.checkHydrated(DATA_TABLE_SELECTOR);
cy.compareSnapshot({
name: "action-elements",
testThreshold: setThresholdBasedOnEnv(DEFAULT_THRESHOLD + 0.038),
cypressScreenshotOptions: {
capture: "viewport",
},
});
});

cy.findShadowEl(DATA_TABLE_SELECTOR, "td")
.eq(1)
.find("span")
.should("not.exist");
});
it("should not render an element in the table cell if the data prop does not contain the actionElement key", () => {
mount(
<IcDataTable
columns={COLS}
data={ACTION_DATA_ELEMENTS}
caption="Data tables"
></IcDataTable>
);

it("should apply styling to the cell container if an action element is present in the cell", () => {
mount(
<IcDataTable
columns={COLS}
data={ACTION_DATA_ELEMENTS}
caption="Data tables"
></IcDataTable>
);
cy.checkHydrated(DATA_TABLE_SELECTOR);

cy.viewport(1024, 768);
cy.findShadowEl(DATA_TABLE_SELECTOR, "td")
.eq(1)
.find("span")
.should("not.exist");
});

cy.checkHydrated(DATA_TABLE_SELECTOR);
it("should apply styling to the cell container if an action element is present in the cell", () => {
mount(
<IcDataTable
columns={COLS}
data={ACTION_DATA_ELEMENTS}
caption="Data tables"
></IcDataTable>
);

cy.findShadowEl(DATA_TABLE_SELECTOR, "td")
.eq(0)
.find("div")
.eq(0)
.should(HAVE_CLASS, "cell-grid-wrapper")
.should(HAVE_CSS, "grid-template-columns", "156.797px 32px");
cy.checkHydrated(DATA_TABLE_SELECTOR);

cy.findShadowEl(DATA_TABLE_SELECTOR, "span")
.should(HAVE_CLASS, "action-element")
.should(HAVE_CSS, "justify-content", "right");
cy.findShadowEl(DATA_TABLE_SELECTOR, "td")
.eq(0)
.find("div")
.eq(0)
.should(HAVE_CLASS, "cell-grid-wrapper")
.should(HAVE_CSS, "grid-template-columns", "156.797px 32px");

cy.findShadowEl(DATA_TABLE_SELECTOR, "span")
.should(HAVE_CLASS, "action-element")
.should(HAVE_CSS, "justify-content", "right");
});
});

describe("IcDataTables with IcPaginationBar", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import {
import {
onComponentRequiredPropUndefined,
isSlotUsed,
getThemeFromContext,
getBrandFromContext,
removeDisabledFalse,
checkSlotInChildMutations,
} from "../../utils/helpers";
import {
IcTheme,
IcThemeForeground,
IcThemeForegroundEnum,
IcBrand,
IcBrandForeground,
IcBrandForegroundEnum,
IcThemeMode,
} from "../../utils/types";
import { IcCardSizes } from "./ic-card-horizontal.types";
Expand All @@ -41,7 +41,7 @@ export class Card {

@Element() el: HTMLIcCardHorizontalElement;

@State() appearance?: IcThemeForeground = "default";
@State() appearance?: IcBrandForeground = "default";
@State() isFocussed: boolean = false;
@State() parentEl: HTMLElement | null = null;
@State() parentIsAnchorTag: boolean = false;
Expand Down Expand Up @@ -143,8 +143,8 @@ export class Card {
}
}

@Listen("themeChange", { target: "document" })
themeChangeHandler(ev: CustomEvent<IcTheme>): void {
@Listen("brandChange", { target: "document" })
brandChangeHandler(ev: CustomEvent<IcBrand>): void {
this.updateTheme(ev.detail.mode);
}

Expand Down Expand Up @@ -180,11 +180,14 @@ export class Card {
this.isFocussed = false;
};

private updateTheme(newTheme: IcThemeForeground = null): void {
const foregroundColor = getThemeFromContext(this.el, newTheme);
private updateTheme(mode: IcBrandForeground = null): void {
const foregroundColor = getBrandFromContext(this.el, mode);

if (foregroundColor !== IcThemeForegroundEnum.Default) {
this.theme = foregroundColor;
if (foregroundColor !== IcBrandForegroundEnum.Default) {
this.theme =
foregroundColor === IcBrandForegroundEnum.Light
? IcBrandForegroundEnum.Dark
: IcBrandForegroundEnum.Light;
}
}

Expand Down Expand Up @@ -229,7 +232,7 @@ export class Card {
clickable: clickable && !disabled,
disabled,
focussed: isFocussed,
dark: appearance === IcThemeForegroundEnum.Dark,
dark: appearance === IcBrandForegroundEnum.Dark,
[`${size}`]: true,
"with-icon": isSlotUsed(this.el, "icon"),
"with-image": isSlotUsed(this.el, "image"),
Expand Down
Loading
Loading