diff options
author | silverwind <me@silverwind.io> | 2022-08-10 16:47:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-10 22:47:28 +0800 |
commit | d751e35d81d3e9e953ac35e868b9714ba4502f67 (patch) | |
tree | 5e6a3042319003707420a7a50b62bf9285a868f1 /web_src | |
parent | 58de07e5fd14c23dd4c4a315b8c5b3fb3219f66a (diff) | |
download | gitea-d751e35d81d3e9e953ac35e868b9714ba4502f67.tar.gz gitea-d751e35d81d3e9e953ac35e868b9714ba4502f67.zip |
Use separate class for tippy targets (#20742)
Previous solution that re-purposed the 'hide' class by making it
`!important` had various unintended side-effects where jQuery .show() was
not able to outweight it. Use a separate class to prevent these
interactions.
Diffstat (limited to 'web_src')
-rw-r--r-- | web_src/js/modules/tippy.js | 7 | ||||
-rw-r--r-- | web_src/less/_base.less | 2 | ||||
-rw-r--r-- | web_src/less/modules/tippy.less | 5 |
3 files changed, 10 insertions, 4 deletions
diff --git a/web_src/js/modules/tippy.js b/web_src/js/modules/tippy.js index 87f9e8a4b0..6f3adadddc 100644 --- a/web_src/js/modules/tippy.js +++ b/web_src/js/modules/tippy.js @@ -12,10 +12,11 @@ export function createTippy(target, opts = {}) { ...opts, }); - // for popups where content refers to a DOM element, we use the 'hide' class to initially hide - // the content, now we can remove it as the content has been removed from the DOM by tippy + // for popups where content refers to a DOM element, we use the 'tippy-target' class + // to initially hide the content, now we can remove it as the content has been removed + // from the DOM by tippy if (opts.content instanceof Element) { - opts.content.classList.remove('hide'); + opts.content.classList.remove('tippy-target'); } return instance; diff --git a/web_src/less/_base.less b/web_src/less/_base.less index f2711c4482..17e9ccfd35 100644 --- a/web_src/less/_base.less +++ b/web_src/less/_base.less @@ -1315,7 +1315,7 @@ footer { } .hide { - display: none !important; + display: none; &.show-outdated { display: none !important; diff --git a/web_src/less/modules/tippy.less b/web_src/less/modules/tippy.less index 1fcd0372ce..25dd7fc987 100644 --- a/web_src/less/modules/tippy.less +++ b/web_src/less/modules/tippy.less @@ -1,5 +1,10 @@ /* styles are based on node_modules/tippy.js/dist/tippy.css */ +// class to hide tippy target elements on page load +.tippy-target { + display: none !important; +} + [data-tippy-root] { max-width: calc(100vw - 10px); } |