Skip to content

Feat: Support Focus on page tabs#2418

Merged
limetech merged 2 commits into
unraid:masterfrom
Squidly271:Feat/FocusFunc
Oct 15, 2025
Merged

Feat: Support Focus on page tabs#2418
limetech merged 2 commits into
unraid:masterfrom
Squidly271:Feat/FocusFunc

Conversation

@Squidly271

@Squidly271 Squidly271 commented Oct 3, 2025

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features
    • Tabs can declare a focus target; when a tab is selected, the specified target is invoked to apply focus, improving navigation and accessibility.
  • Bug Fixes
    • Focus activation avoids fragile execution methods and now safely invokes the declared handler; missing handlers are logged without breaking the UI.

@coderabbitai

coderabbitai Bot commented Oct 3, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Adds a data-focus attribute to tab buttons when a page defines Focus, and updates the tab click handler to call the named function from that attribute (via windowfunctionName) after switching tabs and updating cookies; logs an error if the function is not found.

Changes

Cohort / File(s) Summary
Tabbed main content behavior
emhttp/plugins/dynamix/include/DefaultPageLayout/MainContentTabbed.php
Adds conditional data-focus attribute to tab buttons; modifies click handler to, after tab switch and cookie update, read the attribute as a function name and invoke window[functionName]() if present; logs an error when the function is missing.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant TabUI as Tab Button
  participant ClickHandler as Click Handler Script
  participant Cookies as Cookie Store
  participant FocusFunc as window[functionName]()

  User->>TabUI: Click tab
  TabUI->>ClickHandler: onClick event
  ClickHandler->>ClickHandler: Switch active tab
  ClickHandler->>Cookies: Update tab cookie
  alt data-focus present
    ClickHandler->>FocusFunc: call window[fn]()
    Note right of FocusFunc: Invocation checked before call\n(if undefined -> error logged)
    opt Error occurs
      ClickHandler->>ClickHandler: catch error
      ClickHandler->>ClickHandler: console.error(error)
    end
  else no data-focus
    ClickHandler-->>ClickHandler: No focus action
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I nudge a tab, a gentle hop and click,
A hidden focus named—no eval trick.
If missing, logs will politely tell,
I twitch my nose, all's orderly and well. 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly captures the addition of focus support for page tabs and directly relates to the changes made, staying clear and concise without unnecessary detail.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7f37e70 and cdbd2e9.

📒 Files selected for processing (1)
  • emhttp/plugins/dynamix/include/DefaultPageLayout/MainContentTabbed.php (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • emhttp/plugins/dynamix/include/DefaultPageLayout/MainContentTabbed.php

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

@Squidly271 Squidly271 requested a review from zackspear October 3, 2025 18:27
@github-actions

github-actions Bot commented Oct 3, 2025

Copy link
Copy Markdown

🔧 PR Test Plugin Available

A test plugin has been generated for this PR that includes the modified files.

Version: 2025.10.03.1842
Build: View Workflow Run

📥 Installation Instructions:

Install via Unraid Web UI:

  1. Go to Plugins → Install Plugin
  2. Copy and paste this URL:
https://preview.dl.unraid.net/pr-plugins/pr-2418/webgui-pr-2418.plg
  1. Click Install

Alternative: Direct Download

⚠️ Important Notes:

  • Testing only: This plugin is for testing PR changes
  • Backup included: Original files are automatically backed up
  • Easy removal: Files are restored when plugin is removed
  • Conflicts: Remove this plugin before installing production updates

📝 Modified Files:

Click to expand file list
emhttp/plugins/dynamix/include/DefaultPageLayout/MainContentTabbed.php

🔄 To Remove:

Navigate to Plugins → Installed Plugins and remove webgui-pr-2418, or run:

plugin remove webgui-pr-2418

🤖 This comment is automatically generated and will be updated with each new push to this PR.

@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: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 95bc896 and 7f37e70.

📒 Files selected for processing (1)
  • emhttp/plugins/dynamix/include/DefaultPageLayout/MainContentTabbed.php (2 hunks)

@ljm42 ljm42 added the 7.2 label Oct 13, 2025
@limetech limetech merged commit d48d938 into unraid:master Oct 15, 2025
2 checks passed
@Squidly271 Squidly271 deleted the Feat/FocusFunc branch November 5, 2025 01:35
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.

3 participants