From 4f1a93895a615683c6de77ba33d0903723f51933 Mon Sep 17 00:00:00 2001 From: Blake Vandercar Date: Thu, 9 Jan 2025 08:43:27 -0700 Subject: [PATCH 1/2] fix(Section): make collapsible keyboard accessible --- .../core/src/components/section/section.tsx | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/packages/core/src/components/section/section.tsx b/packages/core/src/components/section/section.tsx index 95f30e54d8..4e80334fbb 100644 --- a/packages/core/src/components/section/section.tsx +++ b/packages/core/src/components/section/section.tsx @@ -17,11 +17,11 @@ import classNames from "classnames"; import * as React from "react"; -import { ChevronDown, ChevronUp, type IconName } from "@blueprintjs/icons"; +import { type IconName } from "@blueprintjs/icons"; import { Classes, Elevation, Utils } from "../../common"; import { DISPLAYNAME_PREFIX, type HTMLDivProps, type MaybeElement, type Props } from "../../common/props"; -import { uniqueId } from "../../common/utils"; +import { clickElementOnKeyPress, uniqueId } from "../../common/utils"; import { Card } from "../card/card"; import { Collapse, type CollapseProps } from "../collapse/collapse"; import { H6 } from "../html/html"; @@ -177,10 +177,6 @@ export const Section: React.FC = React.forwardRef((props, ref) => > {title && (
= React.forwardRef((props, ref) => {isHeaderRightContainerVisible && (
{rightElement} - {collapsible && - (isCollapsed ? ( - - ) : ( - - ))} + {collapsible && ( + + )}
)}
From 2dd14b67cf4a20eff76754b184382f3eb06bb2bb Mon Sep 17 00:00:00 2001 From: Blake Vandercar Date: Thu, 9 Jan 2025 09:17:18 -0700 Subject: [PATCH 2/2] fix: wrap in span --- packages/core/src/components/section/section.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/core/src/components/section/section.tsx b/packages/core/src/components/section/section.tsx index 4e80334fbb..1dd93a275f 100644 --- a/packages/core/src/components/section/section.tsx +++ b/packages/core/src/components/section/section.tsx @@ -17,7 +17,7 @@ import classNames from "classnames"; import * as React from "react"; -import { type IconName } from "@blueprintjs/icons"; +import { ChevronDown, ChevronUp, type IconName } from "@blueprintjs/icons"; import { Classes, Elevation, Utils } from "../../common"; import { DISPLAYNAME_PREFIX, type HTMLDivProps, type MaybeElement, type Props } from "../../common/props"; @@ -201,19 +201,19 @@ export const Section: React.FC = React.forwardRef((props, ref) =>
{rightElement} {collapsible && ( - + className={classNames(Classes.TEXT_MUTED, Classes.INTERACTIVE)} + > + {isCollapsed ? : } + )}
)}