From 47cb417f89936e4bcb9ad37b0758c3de3e437f11 Mon Sep 17 00:00:00 2001 From: Matt Driscoll Date: Thu, 29 Jun 2023 10:49:10 -0700 Subject: [PATCH 1/4] fix(tooltip): deprecate the label property and make it optional. #6329 --- .../src/components/tooltip/tooltip.e2e.ts | 10 +- .../src/components/tooltip/tooltip.stories.ts | 2 +- .../src/components/tooltip/tooltip.tsx | 8 +- .../calcite-components/src/demos/tooltip.html | 94 ++++++------------- 4 files changed, 41 insertions(+), 73 deletions(-) diff --git a/packages/calcite-components/src/components/tooltip/tooltip.e2e.ts b/packages/calcite-components/src/components/tooltip/tooltip.e2e.ts index 5e536df33aa..a62583b2952 100644 --- a/packages/calcite-components/src/components/tooltip/tooltip.e2e.ts +++ b/packages/calcite-components/src/components/tooltip/tooltip.e2e.ts @@ -46,11 +46,15 @@ describe("calcite-tooltip", () => { }); describe("accessible when closed", () => { - accessible(`
😄
`); + accessible( + `Hello World!
Tooltip Reference
` + ); }); describe("accessible when open", () => { - accessible(`
😄
`); + accessible( + `Hello World!
Tooltip Reference
` + ); }); describe("honors hidden attribute", () => { @@ -853,7 +857,7 @@ describe("calcite-tooltip", () => { { name: "shadow-component-a", html: ` - + This data was collected over a 24 hour period ` }, diff --git a/packages/calcite-components/src/components/tooltip/tooltip.stories.ts b/packages/calcite-components/src/components/tooltip/tooltip.stories.ts index 0852bcabce9..2525c1a2d47 100644 --- a/packages/calcite-components/src/components/tooltip/tooltip.stories.ts +++ b/packages/calcite-components/src/components/tooltip/tooltip.stories.ts @@ -68,7 +68,7 @@ darkModeRTL_TestOnly.parameters = { modes: modesDarkDefault }; export const rightAligned_TestOnly = (): string => html`
Hover for Tooltip - + Tooltip content lorem ipsum
`; diff --git a/packages/calcite-components/src/components/tooltip/tooltip.tsx b/packages/calcite-components/src/components/tooltip/tooltip.tsx index 9687b241b55..f6ef5cf0508 100644 --- a/packages/calcite-components/src/components/tooltip/tooltip.tsx +++ b/packages/calcite-components/src/components/tooltip/tooltip.tsx @@ -56,8 +56,12 @@ export class Tooltip implements FloatingUIComponent, OpenCloseComponent { /** Closes the component when the `referenceElement` is clicked. */ @Prop({ reflect: true }) closeOnClick = false; - /** Accessible name for the component. */ - @Prop() label!: string; + /** + * Accessible name for the component. + * + * @deprecated No longer necessary. + */ + @Prop() label: string; /** * Offset the position of the component away from the `referenceElement`. diff --git a/packages/calcite-components/src/demos/tooltip.html b/packages/calcite-components/src/demos/tooltip.html index 4a140c4c1a2..dae9be1f990 100644 --- a/packages/calcite-components/src/demos/tooltip.html +++ b/packages/calcite-components/src/demos/tooltip.html @@ -190,179 +190,139 @@

Tooltip

- +

placement: auto

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
- +

placement: auto-start

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
- +

placement: auto-end

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
- +

placement: top

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
- +

placement: bottom

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
- +

placement: right

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
- +

placement: left

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
- +

placement: top-start

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
- +

placement: top-end

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
- +

placement: bottom-start

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
- +

placement: bottom-end

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
- +

placement: right-start

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
- +

placement: right-end

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
- +

placement: left-start

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
- +

placement: left-end

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
- +

placement: leading-start

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
- +

placement: leading

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
- +

placement: leading-end

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
- +

placement: trailing-end

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
- +

placement: trailing

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
- +

placement: trailing-start

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
- +

placement: auto

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
- +

placement: auto-start

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
- +

placement: auto-end

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
- +

placement: auto

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
- +

placement: auto-start

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
- +

placement: auto-end

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. From a184693c364056ed5ee27b50a092a6e57a6a2a12 Mon Sep 17 00:00:00 2001 From: Matt Driscoll Date: Fri, 30 Jun 2023 09:50:21 -0700 Subject: [PATCH 2/4] review fixes --- packages/calcite-components/src/components/tooltip/tooltip.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/calcite-components/src/components/tooltip/tooltip.tsx b/packages/calcite-components/src/components/tooltip/tooltip.tsx index f6ef5cf0508..9f6b0f67fac 100644 --- a/packages/calcite-components/src/components/tooltip/tooltip.tsx +++ b/packages/calcite-components/src/components/tooltip/tooltip.tsx @@ -59,7 +59,7 @@ export class Tooltip implements FloatingUIComponent, OpenCloseComponent { /** * Accessible name for the component. * - * @deprecated No longer necessary. + * @deprecated No longer necessary due to the label coming from the component's content. Setting aria attributes on the component is not recommended. */ @Prop() label: string; From 073f3985deca00b6a59719cefcaecdcf8e25ab34 Mon Sep 17 00:00:00 2001 From: Matt Driscoll Date: Fri, 30 Jun 2023 09:59:52 -0700 Subject: [PATCH 3/4] wording --- packages/calcite-components/src/components/tooltip/tooltip.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/calcite-components/src/components/tooltip/tooltip.tsx b/packages/calcite-components/src/components/tooltip/tooltip.tsx index 9f6b0f67fac..8e4f8b61229 100644 --- a/packages/calcite-components/src/components/tooltip/tooltip.tsx +++ b/packages/calcite-components/src/components/tooltip/tooltip.tsx @@ -59,7 +59,7 @@ export class Tooltip implements FloatingUIComponent, OpenCloseComponent { /** * Accessible name for the component. * - * @deprecated No longer necessary due to the label coming from the component's content. Setting aria attributes on the component is not recommended. + * @deprecated This is no longer necessary because the component's content provides the description. */ @Prop() label: string; From cd146d5803aeaff3e0af79d039ddad4f72823e29 Mon Sep 17 00:00:00 2001 From: Matt Driscoll Date: Fri, 30 Jun 2023 10:35:25 -0700 Subject: [PATCH 4/4] wording --- packages/calcite-components/src/components/tooltip/tooltip.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/calcite-components/src/components/tooltip/tooltip.tsx b/packages/calcite-components/src/components/tooltip/tooltip.tsx index 8e4f8b61229..4b221917173 100644 --- a/packages/calcite-components/src/components/tooltip/tooltip.tsx +++ b/packages/calcite-components/src/components/tooltip/tooltip.tsx @@ -59,7 +59,7 @@ export class Tooltip implements FloatingUIComponent, OpenCloseComponent { /** * Accessible name for the component. * - * @deprecated This is no longer necessary because the component's content provides the description. + * @deprecated No longer necessary. Overrides the context of the component's description, which could confuse assistive technology users. */ @Prop() label: string;