Skip to content

Fix/4060 download button#4145

Merged
ha2818an merged 2 commits into
mainfrom
fix/4060-download-button
Jul 2, 2026
Merged

Fix/4060 download button#4145
ha2818an merged 2 commits into
mainfrom
fix/4060-download-button

Conversation

@LucyChyzhova

@LucyChyzhova LucyChyzhova commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

fix: #4070

Summary by CodeRabbit

Bug Fixes

  • Prevented duplicate download buttons in the file viewer when unsupported content is shown within other UI that already includes a download button bar.
  • Updated unsupported-file fallback rendering so the download button is only displayed when appropriate.
  • Adjusted file viewer control button positioning for better layout alignment (moved vertical offset from top to bottom).

Review:

  • Commits are atomic
  • Commits have the correct type for the changes made
  • Commits with breaking changes are marked as such

Browsers tested:

(Check any that applies, it's ok to leave boxes unchecked if testing something didn't seem relevant.)

Windows:

  • Chrome
  • Edge
  • Firefox

Linux:

  • Chrome
  • Firefox

macOS:

  • Chrome
  • Firefox
  • Safari

Mobile:

  • Chrome on Android
  • iOS

@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@ha2818an, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 45 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: a2be7b03-f3c5-4a55-9271-f4f75fd745cb

📥 Commits

Reviewing files that changed from the base of the PR and between 2774b25 and aab9503.

📒 Files selected for processing (2)
  • src/components/file-viewer/file-viewer.tsx
  • src/components/file-viewer/partial-styles/ui-controls.scss
📝 Walkthrough

Walkthrough

limel-file-viewer suppresses the inline download button in unsupported-filetype fallbacks when a toolbar already provides one, and changes the .buttons bar positioning from top to bottom.

Changes

file-viewer duplicate download and button positioning fixes

Layer / File(s) Summary
renderNoFileSupportMessage conditional download button
src/components/file-viewer/file-viewer.tsx
renderNoFileSupportMessage accepts an optional withDownloadButton parameter (default true) and guards the download button behind it. renderText passes false to suppress the button; renderEmail wraps its fallback in a <div slot="fallback"> and also passes false.
.buttons vertical positioning
src/components/file-viewer/partial-styles/ui-controls.scss
The .buttons bar's vertical anchor is changed from top: 0.25rem to bottom: 0.25rem, moving the toolbar to the bottom-right.

Estimated code review effort: 2 (Simple) | ~8 minutes

Possibly related PRs

Suggested reviewers: jgroth, Kiarokh

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and related to the download-button fix, though it omits the toolbar overlap part and has the wrong issue number.
Linked Issues check ✅ Passed The changes address both reported problems: the toolbar is repositioned and the unsupported-text/email fallback no longer renders a duplicate download button.
Out of Scope Changes check ✅ Passed The diff is limited to the file-viewer toolbar positioning and fallback download-button behavior, matching the linked issue scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/4060-download-button

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

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

@github-actions

Copy link
Copy Markdown

Documentation has been published to https://lundalogik.github.io/lime-elements/versions/PR-4145/

@LucyChyzhova

Copy link
Copy Markdown
Contributor Author

The PR title references issue #4060, but the PR is actually addressing issue #4070. This is misleading, as the title does not accurately reflect the actual issue being fixed.

yeah, missed the number , should be 4070 instead...

ha2818an
ha2818an previously approved these changes Jun 29, 2026

@ha2818an ha2818an left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verified by linking local lime-element to local lime-bb and checking the example docs. I'd say the comments are nits so approving for now.

Comment thread src/components/file-viewer/file-viewer.tsx
Comment thread src/components/file-viewer/file-viewer.tsx Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

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

⚠️ Outside diff range comments (1)
src/components/file-viewer/file-viewer.tsx (1)

271-279: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a regression test for the text/email fallback path.

This fixes a UI regression-prone branch, but the adjacent coverage shown here only locks in generic div.buttons behavior. Please add a spec/e2e that forces the text/email fallback and asserts there is exactly one download action when allowDownload is enabled.

Also applies to: 294-297, 337-360

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/file-viewer/file-viewer.tsx` around lines 271 - 279, Add a
regression spec/e2e around file-viewer.tsx that exercises the
renderText/renderEmail fallback path, not just the generic renderButtons
behavior. Force the text/email <object> fallback to render, enable
allowDownload, and assert there is exactly one download action exposed in that
state. Use the file-viewer component methods renderText, renderEmail, and
renderButtons to locate the branch and cover the fallback path explicitly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/components/file-viewer/file-viewer.tsx`:
- Around line 271-279: Add a regression spec/e2e around file-viewer.tsx that
exercises the renderText/renderEmail fallback path, not just the generic
renderButtons behavior. Force the text/email <object> fallback to render, enable
allowDownload, and assert there is exactly one download action exposed in that
state. Use the file-viewer component methods renderText, renderEmail, and
renderButtons to locate the branch and cover the fallback path explicitly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: bdba5fff-9802-4c4c-bc45-df26495c9ec8

📥 Commits

Reviewing files that changed from the base of the PR and between e568ae2 and 5a94f4e.

📒 Files selected for processing (1)
  • src/components/file-viewer/file-viewer.tsx

@hatchakka3 hatchakka3 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Changes look good and have been verified by @ha2818an

@ha2818an ha2818an force-pushed the fix/4060-download-button branch from 5a94f4e to 2774b25 Compare July 2, 2026 14:37

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/file-viewer/partial-styles/ui-controls.scss`:
- Around line 4-8: The `.buttons` positioning in the file viewer controls is
still hardcoded, which leaves consumers unable to avoid collisions with their
own UI. Update the `ui-controls.scss` styles for `.buttons` to expose a consumer
override point instead of just changing the inset, such as a CSS custom property
or a `::part(buttons)` hook, and wire it through the file viewer component so
the toolbar position can be customized externally without relying on internal
DOM structure.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1c3cb9a8-f79e-4fc7-9ef4-54f30175e7ac

📥 Commits

Reviewing files that changed from the base of the PR and between 5a94f4e and 2774b25.

📒 Files selected for processing (2)
  • src/components/file-viewer/file-viewer.tsx
  • src/components/file-viewer/partial-styles/ui-controls.scss

Comment on lines 4 to 8
.buttons {
position: absolute;
z-index: 1;
top: 0.25rem;
bottom: 0.25rem;
right: 0.25rem;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy lift

Repositioning doesn't address the root cause from the linked issue.

Issue #4070 notes there's no exposed ::part or CSS variable for consumers to reposition .buttons, so any fixed position can collide with consumer UI. Hardcoding bottom: 0.25rem instead of top just relocates the collision risk (e.g., to bottom-anchored consumer controls) rather than giving consumers a way to override it.

Consider exposing a CSS custom property (e.g. --limel-file-viewer-buttons-inset) or a ::part(buttons) so consumers can reposition the toolbar without depending on internal DOM.

💡 Example: expose a CSS variable for positioning
 .buttons {
     position: absolute;
     z-index: 1;
-    bottom: 0.25rem;
-    right: 0.25rem;
+    bottom: var(--limel-file-viewer-buttons-bottom, 0.25rem);
+    right: var(--limel-file-viewer-buttons-right, 0.25rem);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
.buttons {
position: absolute;
z-index: 1;
top: 0.25rem;
bottom: 0.25rem;
right: 0.25rem;
.buttons {
position: absolute;
z-index: 1;
bottom: var(--limel-file-viewer-buttons-bottom, 0.25rem);
right: var(--limel-file-viewer-buttons-right, 0.25rem);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/file-viewer/partial-styles/ui-controls.scss` around lines 4 -
8, The `.buttons` positioning in the file viewer controls is still hardcoded,
which leaves consumers unable to avoid collisions with their own UI. Update the
`ui-controls.scss` styles for `.buttons` to expose a consumer override point
instead of just changing the inset, such as a CSS custom property or a
`::part(buttons)` hook, and wire it through the file viewer component so the
toolbar position can be customized externally without relying on internal DOM
structure.

When `allowDownload` is enabled and a text or email file cannot be
rendered, the fallback "unsupported file type" message rendered its own
download button on top of the one already shown in the controls bar,
resulting in two download buttons.
@ha2818an ha2818an force-pushed the fix/4060-download-button branch from 2774b25 to aab9503 Compare July 2, 2026 14:51
@ha2818an ha2818an enabled auto-merge (rebase) July 2, 2026 14:51
@ha2818an ha2818an merged commit 537fe83 into main Jul 2, 2026
18 checks passed
@ha2818an ha2818an deleted the fix/4060-download-button branch July 2, 2026 14:56
@lime-opensource

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 39.39.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

file-viewer: overlapping buttons and duplicate download in unsupported fallback

4 participants