Skip to content

Conversation

@yugalkaushik
Copy link
Contributor

Fixes #3773, #3511, #3079
We can close the respective PRs #3514 #3497
Changes:
image
image

I have verified that this pull request:

  • has no linting errors (npm run lint)
  • has no test errors (npm run test)
  • has no typecheck errors (npm run typecheck)
  • is from a uniquely-named feature branch and is up to date with the develop branch.
  • is descriptively named and links to an issue number, i.e. Fixes #123
  • meets the standards outlined in the accessibility guidelines

yugalkaushik and others added 2 commits January 4, 2026 02:06
Signed-off-by: yugalkaushik <yugalkaushik14@gmail.com>
@@ -0,0 +1,79 @@
import React, { ReactElement, useRef, useState } from 'react';

Copy link
Collaborator

@clairep94 clairep94 Jan 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we add some jsdocs for these types & tests for the new component?

Also tests would be great as the common folder has tests for most components now
I think it could be super basic like:

it('does not show the tooltip with the user is not hovering over the element', () => {
  // render tooltip with some child content

  // check screen that child content is present
  // check screen that tooltip text content is not present
})

it('shows the tooltip if the user hovers over the element', () => {
  // render tooltip with some child content

  // trigger a userEvent to hover over the child element
  
   // check screen that child content is present
  // check screen that tooltip text content is not present
})

it('displays the tooltip in the direction passed', () => {})
it('defaults to north if the direction is not passed', () => {})

const [open, setOpen] = useState(false);
const tooltipIdRef = useRef(`tooltip-${Math.random().toString(36).slice(2)}`);

const childProps: Record<string, unknown> = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably want to useMemo so this doesn't cause unnecessary re-renders

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax would be the below

const childProps = useMemo(() => ({...your object}),[...all the mentioned dependencies])

Copy link
Collaborator

@clairep94 clairep94 Jan 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

personally for readability, I would split this into different useMemos by property, especially bc you have the .filter().join() mixed with a bunch of event handlers

But this is a style opinion so not blocking

*/
role?: MenubarItemRole;
selected?: boolean;
tooltipContent?: string;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd maybe link this to TooltipProps so that in case the Tooltip API changes, this component gets synced:

tooltipContent?: TooltipProps['content']

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% familiar with how translations work
Does the translator default to check en-US if say fr-FR['SaveTooltipUnauthenticated'] doesn't work @raclim?

If not you might have to pop the temporary english into each of the language files as placeholders -- I thiiink this is the current pattern I've seen but not 10000% sure

@yugalkaushik
Copy link
Contributor Author

@clairep94 Hi, this code needs some refinement, which I will address shortly. At the moment, I’m unable to spend enough time working on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add accessible & localized common tooltips for disabled file actions and upload button

3 participants