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

fix(box): remove focus outline #7011

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
15 changes: 15 additions & 0 deletions src/components/box/box.pw.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,21 @@ test.describe("should render Box component", () => {
"rgba(0, 20, 30, 0.04) 0px 10px 40px 0px, rgba(0, 20, 30, 0.1) 0px 50px 80px 0px"
);
});

test("should render without a visible focus outline, when focused with a set `tabIndex`", async ({
mount,
page,
}) => {
await mount(<Default tabIndex={0} />);
const boxElement = getDataElementByValue(page, "box");

await boxElement.focus();
await expect(boxElement).toBeFocused();
await expect(boxElement).toHaveCSS(
"outline",
"rgb(255, 255, 255) none 0px"
);
});
});

test.describe("Accessibility tests for Box", () => {
Expand Down
4 changes: 4 additions & 0 deletions src/components/box/box.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ const StyledBox = styled.div<BoxProps>`
${grid}
${calculatePosition}

:focus {
outline: none;
}

${({ theme, borderRadius = "borderRadius000" }) =>
!theme.roundedCornersOptOut &&
css`
Expand Down
Loading