]> source.dussan.org Git - gitea.git/commit
Correctly query the primary button in a form (#32438)
authorwxiaoguang <wxiaoguang@gmail.com>
Wed, 6 Nov 2024 20:21:53 +0000 (04:21 +0800)
committerGitHub <noreply@github.com>
Wed, 6 Nov 2024 20:21:53 +0000 (04:21 +0800)
commitb573512312d82e894db7aac89f4938a6b61e1e70
treec80b6965a6a3831c64fce979c0dfe12f850c6acb
parent41b4ef825dba14f11b2e9454692b999f92ee1a42
Correctly query the primary button in a form (#32438)

The "primary button" is used at many places, but sometimes they might
conflict (due to button switch, hidden panel, dropdown menu, etc).

Sometimes we could add a special CSS class for the buttons, but
sometimes not (see the comment of QuickSubmit)

This PR introduces `querySingleVisibleElem` to help to get the correct
primary button (the only visible one), and prevent from querying the
wrong buttons.

Fix #32437

---------

Co-authored-by: silverwind <me@silverwind.io>
web_src/js/features/comp/QuickSubmit.ts
web_src/js/features/repo-issue-edit.ts
web_src/js/utils/dom.test.ts
web_src/js/utils/dom.ts