Skip to content

[WEB-4724] fix: editor tooltip#7708

Merged
pushya22 merged 2 commits intopreviewfrom
fix-editor-tooltip-code-refactoring
Sep 2, 2025
Merged

[WEB-4724] fix: editor tooltip#7708
pushya22 merged 2 commits intopreviewfrom
fix-editor-tooltip-code-refactoring

Conversation

@anmolsinghbhatia
Copy link
Collaborator

@anmolsinghbhatia anmolsinghbhatia commented Sep 2, 2025

Summary by CodeRabbit

  • Refactor
    • Standardized tooltip component across the editor (code blocks, image toolbar, and image full-screen actions) for a consistent look and behavior.
  • Chores
    • Removed an unused dependency from the editor package to streamline the build and reduce maintenance overhead.

@anmolsinghbhatia anmolsinghbhatia self-assigned this Sep 2, 2025
Copilot AI review requested due to automatic review settings September 2, 2025 14:44
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 2, 2025

Walkthrough

Tooltip imports in editor components were switched from @plane/propel/tooltip to @plane/ui, and the editor package removed @plane/propel from dependencies. No functional or public API changes in the components.

Changes

Cohort / File(s) Summary of Changes
Dependency cleanup
packages/editor/package.json
Removed dependency @plane/propel from dependencies.
Tooltip import migration
packages/editor/src/core/extensions/code/code-block-node-view.tsx, packages/editor/src/core/extensions/custom-image/components/toolbar/alignment.tsx, packages/editor/src/core/extensions/custom-image/components/toolbar/download.tsx, packages/editor/src/core/extensions/custom-image/components/toolbar/full-screen/root.tsx
Updated Tooltip import source from @plane/propel/tooltip to @plane/ui; no logic or API changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

🌐frontend, ✍️editor

Suggested reviewers

  • sriramveeraghanta
  • prateekshourya29

Poem

I nudge my whiskers, lighten my load,
Hopped from Propel to a UI road.
Tooltips tidy, dependencies slim—
My editor hums a sleeker hymn.
Thump-thump! goes the merge with glee,
Fewer carrots to carry for me. 🥕✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-editor-tooltip-code-refactoring

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@makeplane
Copy link

makeplane bot commented Sep 2, 2025

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes editor tooltip imports by migrating from @plane/propel/tooltip to @plane/ui across multiple editor components and removing the propel dependency.

  • Updated tooltip imports in 4 editor components (image toolbar and code block)
  • Removed @plane/propel dependency from package.json

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/editor/src/core/extensions/custom-image/components/toolbar/full-screen/root.tsx Updated Tooltip import from propel to ui package
packages/editor/src/core/extensions/custom-image/components/toolbar/download.tsx Updated Tooltip import from propel to ui package
packages/editor/src/core/extensions/custom-image/components/toolbar/alignment.tsx Updated Tooltip import from propel to ui package
packages/editor/src/core/extensions/code/code-block-node-view.tsx Updated Tooltip import from propel to ui package
packages/editor/package.json Removed @plane/propel dependency
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/editor/src/core/extensions/custom-image/components/toolbar/download.tsx (1)

16-16: Harden window.open against tabnabbing

Open the new tab without exposing window.opener.

-        onClick={() => window.open(src, "_blank")}
+        onClick={() => {
+          const w = window.open(src, "_blank", "noopener,noreferrer");
+          if (w) w.opener = null;
+        }}

(Optional) If src can be user-influenced, validate allowed protocols (http:, https:, blob:, data:) before opening.

🧹 Nitpick comments (4)
packages/editor/src/core/extensions/custom-image/components/toolbar/alignment.tsx (2)

35-42: Add ARIA for the alignment menu trigger

Expose state to assistive tech and link the trigger to the menu.

-        <button
+        <button
           type="button"
           className="h-full flex items-center gap-1 text-white/60 hover:text-white transition-colors"
-          onClick={() => setIsDropdownOpen((prev) => !prev)}
+          onClick={() => setIsDropdownOpen((prev) => !prev)}
+          aria-haspopup="menu"
+          aria-expanded={isDropdownOpen}
+          aria-controls="image-align-menu"
+          aria-label="Align image"
         >

45-60: Add roles and selection state for options; provide non-tooltip fallback on touch

Improve a11y for the menu and options; ensure discoverability when tooltips are disabled.

-      {isDropdownOpen && (
-        <div className="absolute top-full left-1/2 -translate-x-1/2 mt-0.5 h-7 bg-black/80 flex items-center gap-2 px-2 rounded">
+      {isDropdownOpen && (
+        <div
+          id="image-align-menu"
+          role="menu"
+          className="absolute top-full left-1/2 -translate-x-1/2 mt-0.5 h-7 bg-black/80 flex items-center gap-2 px-2 rounded"
+        >
           {IMAGE_ALIGNMENT_OPTIONS.map((option) => (
-            <Tooltip disabled={isTouchDevice} key={option.value} tooltipContent={option.label}>
+            <Tooltip disabled={isTouchDevice} key={option.value} tooltipContent={option.label}>
               <button
                 type="button"
                 className="flex-shrink-0 h-full grid place-items-center text-white/60 hover:text-white transition-colors"
+                role="menuitemradio"
+                aria-checked={option.value === activeAlignment}
+                aria-label={option.label}
+                title={isTouchDevice ? option.label : undefined}
                 onClick={() => {
                   handleChange(option.value);
                   setIsDropdownOpen(false);
                 }}
               >
                 <option.icon className="size-3" />
               </button>
             </Tooltip>
           ))}
         </div>
       )}
packages/editor/src/core/extensions/custom-image/components/toolbar/full-screen/root.tsx (1)

43-54: Minor a11y: indicate dialog intent on the trigger

Advertise that this opens a modal/dialog, and reflect state.

-        <button
+        <button
           type="button"
           onClick={(e) => {
             e.preventDefault();
             e.stopPropagation();
             setIsFullScreenEnabled(true);
           }}
           className="flex-shrink-0 h-full grid place-items-center text-white/60 hover:text-white transition-colors"
           aria-label="View image in full screen"
+          aria-haspopup="dialog"
+          aria-expanded={isFullScreenEnabled}
+          aria-controls="image-fullscreen-modal"
         >

Also ensure ImageFullScreenModal renders with role="dialog" and aria-modal="true", focuses an element on open, and restores focus on close.

packages/editor/src/core/extensions/code/code-block-node-view.tsx (1)

40-56: Add accessible name and cleanup timer for copy button

  • Provide an aria-label so the icon-only control is announced.
  • Clear the timeout on unmount to avoid lingering timers.
-        <button
+        <button
           type="button"
           className={cn(
             "group/button hidden group-hover/code:flex items-center justify-center absolute top-2 right-2 z-10 size-8 rounded-md bg-custom-background-80 border border-custom-border-200 transition duration-150 ease-in-out backdrop-blur-sm",
             {
               "bg-green-500/30 hover:bg-green-500/30 active:bg-green-500/30": copied,
             }
           )}
           onClick={copyToClipboard}
+          aria-label={copied ? "Copied" : "Copy code"}
         >

Outside this hunk, add a cleanup for the timer:

// add near other hooks
const timeoutRef = useRef<number | null>(null);
useEffect(() => () => { if (timeoutRef.current) window.clearTimeout(timeoutRef.current); }, []);

// in copyToClipboard, replace setTimeout with:
timeoutRef.current = window.setTimeout(() => setCopied(false), 1000);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 28d368d and 20629fd.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (5)
  • packages/editor/package.json (0 hunks)
  • packages/editor/src/core/extensions/code/code-block-node-view.tsx (1 hunks)
  • packages/editor/src/core/extensions/custom-image/components/toolbar/alignment.tsx (1 hunks)
  • packages/editor/src/core/extensions/custom-image/components/toolbar/download.tsx (1 hunks)
  • packages/editor/src/core/extensions/custom-image/components/toolbar/full-screen/root.tsx (1 hunks)
💤 Files with no reviewable changes (1)
  • packages/editor/package.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Build and lint web apps
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (5)
packages/editor/src/core/extensions/custom-image/components/toolbar/download.tsx (2)

14-21: LGTM: accessible control

Good: explicit aria-label on the icon-only button and clear tooltip copy.


3-3: Confirm Tooltip API parity
Verify that @plane/ui exports Tooltip with the same tooltipContent and disabled props as the previous @plane/propel/tooltip implementation to avoid any silent UI regressions.

packages/editor/src/core/extensions/custom-image/components/toolbar/alignment.tsx (1)

5-5: Tooltip supports disabled and tooltipContent
The Tooltip component’s props include both disabled and tooltipContent as defined in ITooltipProps, so no changes are needed.

packages/editor/src/core/extensions/custom-image/components/toolbar/full-screen/root.tsx (1)

4-4: Validate Tooltip API compatibility
Confirm that props passed to <Tooltip> in packages/editor/src/core/extensions/custom-image/components/toolbar/full-screen/root.tsx match the current @plane/ui API.

packages/editor/src/core/extensions/code/code-block-node-view.tsx (1)

10-10: tooltipContent prop is correct Confirmed that ITooltipProps in @plane/ui defines a tooltipContent prop. No changes needed.

@pushya22 pushya22 merged commit 1c28bd5 into preview Sep 2, 2025
7 of 9 checks passed
@pushya22 pushya22 deleted the fix-editor-tooltip-code-refactoring branch September 2, 2025 15:10
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.

4 participants