Skip to content

Conversation

@silverwind
Copy link
Member

@silverwind silverwind commented May 12, 2025

Small convenience that saves me one click. When opening the Code popup, automatically focus the URL <input> element so it can be copied with CTRL-C. Also re-focus when switching the tabs.

image

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label May 12, 2025
@silverwind
Copy link
Member Author

I guess I could also just have used the Copy URL button, but out of habit, I prefer to CTRL-C. I guess stealing the user focus from the code button may still be okay in this case.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels May 12, 2025
@wxiaoguang
Copy link
Contributor

I am sure we need to add a general "autofocus" support for such "popup" elements, just like "dialog" and what Fomantic UI "modal" does.

@wxiaoguang
Copy link
Contributor

And using onMount seems not right. It should use onShow?

@silverwind
Copy link
Member Author

onShow did not work, it seems that one invokes too early. There's also a onShown but it never triggered in my tests. autofocus attribute needs some testing whether it can work in tippy, not sure.

https://atomiks.github.io/tippyjs/v6/all-props/#onshow
https://atomiks.github.io/tippyjs/v6/all-props/#onmount
https://atomiks.github.io/tippyjs/v6/all-props/#onshown

@silverwind
Copy link
Member Author

After thinking some more, I think it's not a good idea after all to alter the focus in this case, GitHub also does not do it, and clicking "Copy URL" ought to be good enough.

@silverwind silverwind closed this May 12, 2025
@wxiaoguang
Copy link
Contributor

IIRC, tippy is unmaintained since many years ago, and it's not the first time that we encounter its bug:

image

@wxiaoguang
Copy link
Contributor

Hmm, tippy repo is archived, one more unmaintained dependency package .....

@go-gitea go-gitea locked as resolved and limited conversation to collaborators Aug 11, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

lgtm/need 1 This PR needs approval from one additional maintainer to be merged. modifies/frontend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants