jojo/templates/repo
Henry Catalini Smith 8a6d76cff4 Preserve focus on star/unstar & watch/unwatch buttons after click (#11932)
Fixes https://codeberg.org/forgejo/forgejo/issues/11880.

Adding `hx-on::after-settle="this.querySelector('button').focus()"` restores focus after the content has been swapped and the DOM has been setled. I tried `hx-on::after-swap` first since it's mentioned more often in https://github.com/bigskysoftware/htmx/issues/1869, but it didn't work.

The demo attached in `focus.mp4` runs through a series of repeated clicks on both buttons. You can hear the screen reader announce the button's new label when focus is restored.

### Documentation

- [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [ ] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [x] This change will be noticed by a Forgejo user or admin (feature, bug fix, performance, etc.). I suggest to include a release note for this change.
- [ ] This change is not visible to a Forgejo user or admin (refactor, dependency upgrade, etc.). I think there is no need to add a release note for this change.

*The decision if the pull request will be shown in the release notes is up to the mergers / release team.*

The content of the `release-notes/<pull request number>.md` file will serve as the basis for the release notes. If the file does not exist, the title of the pull request will be used instead.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/11932
Reviewed-by: Andreas Ahlenstorf <aahlenst@noreply.codeberg.org>
Co-authored-by: Henry Catalini Smith <henry@catalinismith.se>
Co-committed-by: Henry Catalini Smith <henry@catalinismith.se>
2026-04-08 02:32:14 +02:00
..
actions feat: show workflow name for scheduled runs (#11770) 2026-03-24 01:27:32 +01:00
branch fix(ui): show switch default branch button in branch list only for repo admins (#10814) 2026-01-14 08:15:39 +01:00
code feat: replace cross origin protection (#9830) 2025-10-29 22:43:22 +01:00
diff chore(ui): cleanup reviews css, improve consistency (#10268) 2025-12-01 01:30:25 +01:00
editor feat(ui): replace Monaco with CodeMirror (#10559) 2026-01-04 23:52:33 +01:00
find Migrate gt-hidden to tw-hidden (#30046) 2024-03-30 07:17:29 +01:00
graph fix: display orphan branches separately in commit graph (#10484) 2025-12-29 02:53:54 +01:00
issue Add aria-label="Copy" to copy button (#11895) 2026-04-03 16:57:53 +02:00
migrate chore(i18n): migrate strings to json, unhardcode one, improve plurals (#11879) 2026-04-03 14:11:48 +02:00
projects Migrate margin and padding helpers to tailwind (#30043) 2024-03-30 07:17:29 +01:00
pulls chore(ui): cleanup PR checks area (#10768) 2026-01-10 23:44:42 +01:00
release feat(ui): responsive releases list (#11080) 2026-02-07 19:15:14 +01:00
settings fix: store pull mirror creds encrypted with keying (#11909) 2026-04-04 13:53:22 +02:00
tag fix(ui): fix alignment of items in tag signature (#9398) 2025-09-24 14:54:24 +02:00
wiki chore: rename SafeHTML to TrustHTML (#11481) 2026-03-08 02:41:37 +01:00
activity.tmpl Show repo activities even if only code unit active or git repo is empty but issue is active (#3455) 2024-04-28 13:47:52 +00:00
admin_flags.tmpl [FEAT] Repository flags 2024-02-05 16:09:42 +01:00
blame.tmpl ui(blame): remove broken padding (#4318) 2024-07-04 11:46:31 +00:00
branch_dropdown.tmpl fix(ui): show commit icon in branch dropdown button when viewing a commit (#7571) 2025-04-19 04:33:07 +00:00
clone_buttons.tmpl Refactor clone-panel styles (#29861) 2024-03-26 19:04:24 +01:00
clone_script.tmpl Customizable "Open with" applications for repository clone (#29320) 2024-03-23 11:58:54 +01:00
code_frequency.tmpl fix(i18n): hardcoded strings in repository activity graphs (#11735) 2026-03-19 15:41:33 +01:00
commit_header.tmpl fix(ui): improve Git notes editing (#11365) 2026-03-10 23:49:18 +01:00
commit_load_branches_and_tags.tmpl Implement single-commit PR review flow (#7155) 2025-06-17 09:31:50 +02:00
commit_page.tmpl chore: extract commit header template (#8061) 2025-06-05 11:35:08 +02:00
commit_status.tmpl Restore warning commit status (#27504) 2023-10-08 22:16:06 +00:00
commit_statuses.tmpl Replace 10 more gt- classes with tw- (#29945) 2024-03-26 19:04:27 +01:00
commits.tmpl fix(ui): move file rename notice to before pagination (#8818) 2025-08-10 21:35:34 +02:00
commits_list.tmpl feat: add tag label to commit list view (#8759) 2025-08-06 14:47:51 +02:00
commits_list_small.tmpl Implement single-commit PR review flow (#7155) 2025-06-17 09:31:50 +02:00
commits_search_dropdown.tmpl Unify search boxes (#29530) 2024-03-20 12:31:05 +00:00
commits_table.tmpl chore(i18n): migrate strings to json, unhardcode one, improve plurals (#11879) 2026-04-03 14:11:48 +02:00
contributors.tmpl Add "n commits" link to contributors in contributors graph page (#32799) 2024-12-15 13:21:02 +01:00
create.tmpl feat: replace cross origin protection (#9830) 2025-10-29 22:43:22 +01:00
create_advanced.tmpl New repo: Rework advanced and template sections 2024-12-28 22:32:19 +01:00
create_basic.tmpl fix(ui): make limits clearer in create repo form (#7402) 2025-05-20 16:37:15 +02:00
create_from_template.tmpl New repo: Rework advanced and template sections 2024-12-28 22:32:19 +01:00
create_helper.tmpl Remove incorrect and unnecessary Escape from templates (#29394) 2024-02-26 22:30:27 +01:00
create_init.tmpl fix(ui): wrap items in gitignore dropdown (#8830) 2025-08-09 19:33:18 +02:00
empty.tmpl fix(ui): clarify repo init instruction for sha256 (#7394) 2025-03-30 18:08:05 +00:00
file_info.tmpl [UI] Adjust trailing EOL behavior for empty file 2024-08-19 20:23:15 +02:00
flags.tmpl feat: replace cross origin protection (#9830) 2025-10-29 22:43:22 +01:00
forks.tmpl Migrate margin and padding helpers to tailwind (#30043) 2024-03-30 07:17:29 +01:00
graph.tmpl fix(ui): use gap in switch items (#7581) 2025-04-21 04:25:08 +00:00
header.tmpl fix: store pull mirror creds encrypted with keying (#11909) 2026-04-04 13:53:22 +02:00
header_fork.tmpl feat: improve tooltips and aria-labels of stars/forks/watchers links (#9754) 2025-10-19 18:33:26 +02:00
home.tmpl feat(ui): add switch between formats when previewing CITATION.{cff,bib} files (#9103) 2025-11-14 14:39:20 +01:00
icon.tmpl Replace 10 more gt- classes with tw- (#29945) 2024-03-26 19:04:27 +01:00
latest_commit.tmpl Show if commit is signed in activity feed and unify sha box (#6933) 2025-05-03 10:54:52 +00:00
navbar.tmpl Hide activity contributors, recent commits and code frequrency left tabs if there is no code permission (#34053) 2025-04-01 02:28:02 +02:00
packages.tmpl Fix inconsistent user profile layout across tabs (#25625) 2023-07-06 18:59:24 +00:00
pulse.tmpl chore: rename SafeHTML to TrustHTML (#11481) 2026-03-08 02:41:37 +01:00
recent_commits.tmpl fix(i18n): hardcoded strings in repository activity graphs (#11735) 2026-03-19 15:41:33 +01:00
release_tag_header.tmpl chore(i18n): migrate strings to json, unhardcode one, improve plurals (#11879) 2026-04-03 14:11:48 +02:00
search.tmpl ui(code-search): fix to use CodeSearchMode 2024-09-16 16:20:55 +02:00
search_name.tmpl Clean template/helper.go (#23922) 2023-04-07 03:31:41 -04:00
shabox.tmpl chore(ui): improve hashbox (#8721) 2025-08-03 05:49:24 +02:00
shabox_badge.tmpl chore(ui): clean up hashbox CSS, small design changes (#7822) 2025-05-25 12:51:27 +02:00
star_unstar.tmpl Preserve focus on star/unstar & watch/unwatch buttons after click (#11932) 2026-04-08 02:32:14 +02:00
sub_menu.tmpl chore(i18n): migrate strings to json, unhardcode one, improve plurals (#11879) 2026-04-03 14:11:48 +02:00
unicode_escape_prompt.tmpl templates: remove superfluous SanitizeHTML 2024-03-11 23:36:58 +07:00
upload.tmpl Always use ctx.Locale.Tr inside templates (#27231) 2023-09-25 08:56:50 +00:00
user_cards.tmpl fix(ui): ensure same width of usercards in grid (#6799) 2025-05-25 13:31:53 +02:00
view_file.tmpl feat(ui): add switch between formats when previewing CITATION.{cff,bib} files (#9103) 2025-11-14 14:39:20 +01:00
view_list.tmpl Improve repo file list table semantics for screen readers (#11846) 2026-04-08 02:20:35 +02:00
watch_unwatch.tmpl Preserve focus on star/unstar & watch/unwatch buttons after click (#11932) 2026-04-08 02:32:14 +02:00
watchers.tmpl Fix user-cards format (#24428) 2023-04-29 15:43:01 -04:00