Fix inconsistent disabled styling on logged-out repo header buttons#37406
Fix inconsistent disabled styling on logged-out repo header buttons#37406wxiaoguang merged 10 commits intogo-gitea:mainfrom
Conversation
wxiaoguang
left a comment
There was a problem hiding this comment.
Then, you also disabled the "tooltip"
|
Maybe it needs a |
|
No, you can't do so. You also disabled the links. Anonymous visitor can click the links to visit the "watchers" page. |
It is definitely your guess which would make the system more messy. Everything should go as what it should, don't use unnecessary tricks to make things more complicated than it should. TBH, I've lost count of how many bugs I have caught and blocked during the PR review stage. Otherwise, I can't imagine how many regression reports there would be when a new release is published. |
|
Hmm, maybe CSS-only border fix then. |
1055d48 to
e577c2f
Compare
|
Fix is now CSS only, a bit complicated selectors but see no other way. |
The simplest way is to make the "watch" button have |
Move the `disabled` class from the inner `<button>` to the wrapping `.ui.labeled.button` div on watch and star so all three buttons render consistently, matching the existing fork button pattern. Re-enable pointer events on the wrapper itself (so the tooltip still fires) and apply `pointer-events: none` only to the inner button, leaving the label link clickable. Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
e577c2f to
53810c1
Compare
Done in 53810c1. |
|
Complete fix should be like this 89469fe The |
Hmm it's not quite consistent, checking. |
Add tw-opacity-[var(--opacity-disabled)] to the wrapper so the three buttons visually fade when unavailable, matching the previous look. Apply the same pointer-events-none + opacity pattern to the fork button for full three-way consistency. Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
|
These templates are a bit messy, I will extract into new sub-templates for repo header content. |
Relocate watch_unwatch.tmpl and star_unstar.tmpl into templates/repo/header/ and extract the inline fork button (+ modal) out of header.tmpl into header/fork.tmpl. Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
|
All 3 buttons now live in a new |
|
But no, the "link" is clickable, it shouldn't be disabled, shouldn't use "disabled" color. I believe my solution is already the correct one, and simple enough |
But we want to indicate reduced functionality over the whole button+counter imho, that's what the opacity now does. Or maybe we just scrap the whole idea and remove the opacity trick altogether making them render the same logged in and logged out? Might be cleaner. |
The counter link just works, why it should be reduced for its functionality.
It is my commit 89469fe And I have explained the details in comments. |
Or even better, lead users to login, then no need to disable anything. |
I'll do that. IIRC, that is also how GitHub handles it. |
Remove all disabled-state visual styling (opacity, cursor-default, pointer-events helpers, "not using disabled" comments) on the watch, star and fork buttons. For logged-out users the action element becomes a plain link to /user/login?redirect_to=<current-page>, so the buttons render identically whether signed in or not. Fork's signed-but-cannot-fork-own-repo path keeps tw-pointer-events-none on the inner link to block clicks while still showing its tooltip. Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
|
Done in 23bcbbd, manually tested all behaviours. |
There was a problem hiding this comment.
Pull request overview
This PR aims to make the repo header watch/star/fork controls behave consistently in the logged-out (and other non-actionable) states by refactoring them into dedicated header templates and adjusting how the controls are rendered.
Changes:
- Extract watch/star/fork header controls into
templates/repo/header/*templates and updatetemplates/repo/header.tmplto use them. - Update watch/star action routers to render the new partial template names for fetch-sync updates.
- Adjust watch/star/fork “guest” rendering to use login links (and reorganize fork modal rendering).
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| templates/repo/header/watch.tmpl | Reworks watch control markup (button → anchor) and guest behavior. |
| templates/repo/header/star.tmpl | Reworks star control markup (button → anchor) and guest behavior. |
| templates/repo/header/fork.tmpl | Introduces extracted fork control template and fork selection modal. |
| templates/repo/header.tmpl | Switches repo header to use the new extracted watch/star/fork templates. |
| routers/web/repo/watch.go | Updates the watch action partial template name to the new header template. |
| routers/web/repo/star.go | Updates the star action partial template name to the new header template. |
Comments suppressed due to low confidence (2)
templates/repo/header/watch.tmpl:8
- When the user is signed in, this is rendered as an without an href. Anchors without href are not keyboard-focusable, which is an accessibility regression compared to the previous . Consider adding
href="#"(the fetch-action handler already calls preventDefault) or use a for the signed-in case and keep the guest case as a link to login.
templates/repo/header/star.tmpl:8 - Same issue as watch: in the signed-in branch this has no href, so it won’t be reachable via keyboard navigation. Add
href="#"(click is prevented by the fetch-action handler) or keep using a for the fetch-action trigger.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
* main: Add DEFAULT_TITLE_SOURCE setting for pull request title default behavior (go-gitea#37465) Fix compare dropdown for branches without common history (go-gitea#37470) FIX: URL sanitization to handle schemeless credentials (go-gitea#37440) Refactor pull request view (4) (go-gitea#37451) Fix scheduled action panic with null event payload (go-gitea#37459) Fix attachment Content-Security-Policy (go-gitea#37455) [skip ci] Updated translations via Crowdin Rename CurrentRefPath to CurrentRefSubURL (go-gitea#37453) Clean up org pages layout (go-gitea#37445) Fix script error alert (go-gitea#37458) Fix inconsistent disabled styling on logged-out repo header buttons (go-gitea#37406) Add API endpoint to reply to pull request review comments (go-gitea#36683) Add CurrentURL template variable back (go-gitea#37444)
Make the watch, star, and fork buttons in the repo header consistent for logged-out users:
header.tmplinto a dedicatedtemplates/repo/header/folder (fork.tmpl,star.tmpl,watch.tmpl).This PR was written with the help of Claude Opus 4.7