Skip to content

Commit c296bdc

Browse files
silverwindSysoev, Vladimir
authored and
Sysoev, Vladimir
committed
Use separate class for tippy targets (go-gitea#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.
1 parent 4d956c0 commit c296bdc

File tree

6 files changed

+13
-7
lines changed

6 files changed

+13
-7
lines changed

Diff for: templates/base/head_navbar.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
<span class="sr-mobile-only">{{.locale.Tr "active_stopwatch"}}</span>
8787
</span>
8888
</a>
89-
<div class="active-stopwatch-popup hide">
89+
<div class="active-stopwatch-popup tippy-target">
9090
<div class="df ac">
9191
<a class="stopwatch-link df ac" href="{{.ActiveStopwatch.IssueLink}}">
9292
{{svg "octicon-issue-opened" 16 "mr-3"}}

Diff for: templates/repo/commit_statuses.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<a class="ui link commit-statuses-trigger vm">{{template "repo/commit_status" .Status}}</a>
2-
<div class="ui commit-statuses-popup commit-statuses hide">
2+
<div class="ui commit-statuses-popup commit-statuses tippy-target">
33
<div class="ui relaxed list divided">
44
{{range .Statuses}}
55
<div class="ui item singular-status df">

Diff for: templates/repo/view_file.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
{{end}}
121121
</tbody>
122122
</table>
123-
<div class="code-line-menu ui vertical pointing menu hide">
123+
<div class="code-line-menu ui vertical pointing menu tippy-target">
124124
{{if $.Permission.CanRead $.UnitTypeIssues}}
125125
<a class="item ref-in-new-issue" href="{{.RepoLink}}/issues/new?body={{.Repository.HTMLURL}}{{printf "/src/commit/" }}{{PathEscape .CommitID}}/{{PathEscapeSegments .TreePath}}" rel="nofollow noindex">{{.locale.Tr "repo.issues.context.reference_issue"}}</a>
126126
{{end}}

Diff for: web_src/js/modules/tippy.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ export function createTippy(target, opts = {}) {
1212
...opts,
1313
});
1414

15-
// for popups where content refers to a DOM element, we use the 'hide' class to initially hide
16-
// the content, now we can remove it as the content has been removed from the DOM by tippy
15+
// for popups where content refers to a DOM element, we use the 'tippy-target' class
16+
// to initially hide the content, now we can remove it as the content has been removed
17+
// from the DOM by tippy
1718
if (opts.content instanceof Element) {
18-
opts.content.classList.remove('hide');
19+
opts.content.classList.remove('tippy-target');
1920
}
2021

2122
return instance;

Diff for: web_src/less/_base.less

+1-1
Original file line numberDiff line numberDiff line change
@@ -1315,7 +1315,7 @@ footer {
13151315
}
13161316

13171317
.hide {
1318-
display: none !important;
1318+
display: none;
13191319

13201320
&.show-outdated {
13211321
display: none !important;

Diff for: web_src/less/modules/tippy.less

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
/* styles are based on node_modules/tippy.js/dist/tippy.css */
22

3+
// class to hide tippy target elements on page load
4+
.tippy-target {
5+
display: none !important;
6+
}
7+
38
[data-tippy-root] {
49
max-width: calc(100vw - 10px);
510
}

0 commit comments

Comments
 (0)