Feat: Support Focus on page tabs#2418
Conversation
WalkthroughAdds 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
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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Comment |
🔧 PR Test Plugin AvailableA test plugin has been generated for this PR that includes the modified files. Version: 📥 Installation Instructions:Install via Unraid Web UI:
Alternative: Direct Download
|
Summary by CodeRabbit