8000 Fix navbar `+` menu flashing on page load by silverwind · Pull Request #31281 · go-gitea/gitea · GitHub
[go: up one dir, main page]

Skip to content

Fix navbar + menu flashing on page load #31281

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jun 12, 2024
Prev Previous commit
Next Next commit
remove 'ui secondary menu' from navbar left/right
  • Loading branch information
silverwind committed Jun 11, 2024
commit 76f5e50c71f0cafba5ef7d23d1a92cacafff5de0
8 changes: 4 additions & 4 deletions templates/base/head_navbar.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
{{end}}

<nav id="navbar" aria-label="{{ctx.Locale.Tr "aria.navbar"}}">
<div class="navbar-left ui secondary menu">
<div class="navbar-left">
<!-- the logo -->
<a class="item" id="navbar-logo" href="{{AppSubUrl}}/" aria-label="{{if .IsSigned}}{{ctx.Locale.Tr "dashboard"}}{{else}}{{ctx.Locale.Tr "home"}}{{end}}">
<img width="30" height="30" src="{{AssetUrlPrefix}}/img/logo.svg" alt="{{ctx.Locale.Tr "logo"}}" aria-hidden="true">
</a>

<!-- mobile right menu, it must be here because in mobile view, each item is a flex column, the first item is a full row column -->
<div class="ui secondary menu item navbar-mobile-right only-mobile">
<div class="ui secondary menu item navbar-mobile-right only-mobile tw-my-0">
{{if and .IsSigned EnableTimetracking .ActiveStopwatch}}
<a id="mobile-stopwatch-icon" class="active-stopwatch item tw-mx-0" href="{{.ActiveStopwatch.IssueLink}}" title="{{ctx.Locale.Tr "active_stopwatch"}}" data-seconds="{{.ActiveStopwatch.Seconds}}">
<div class="tw-relative">
Expand Down Expand Up @@ -61,7 +61,7 @@
</div>

<!-- the full dropdown menus -->
<div class="navbar-right ui secondary menu">
<div class="navbar-right">
{{if and .IsSigned .MustChangePassword}}
<div class="ui dropdown jump item" data-tooltip-content="{{ctx.Locale.Tr "user_profile_and_more"}}">
<span class="text tw-flex tw-items-center">
Expand Down Expand Up @@ -104,7 +104,7 @@
<span class="not-mobile">{{svg "octicon-triangle-down"}}</span>
<span class="only-mobile">{{ctx.Locale.Tr "create_new"}}</span>
</span>
<div class="menu">
<div class="left menu">
<a class="item" href="{{AppSubUrl}}/repo/create">
{{svg "octicon-plus"}} {{ctx.Locale.Tr "new_repo"}}
</a>
Expand Down
3 changes: 1 addition & 2 deletions web_src/css/modules/header.css
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,7 @@ h4.ui.header .sub.header {

/* open dropdown menus to the left in right-attached headers */
/* this method must be used instead of "left menu" because otherwise the menu will flash on page load because of `display` CSS. */
.ui.attached.header > .ui.right .ui.dropdown .menu,
.navbar-right .ui.dropdown .menu {
.ui.attached.header > .ui.right .ui.dropdown .menu {
right: 0;
left: auto;
}
Expand Down
18 changes: 14 additions & 4 deletions web_src/css/modules/navbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,26 @@
margin: 0;
display: flex;
align-items: center;
gap: 5px;
}

#navbar-logo {
margin: 0;
}

.navbar-left > .item,
.navbar-right > .item {
color: var(--color-nav-text);
position: relative;
text-decoration: none;
line-height: var(--line-height-default);
flex: 0 0 auto;
font-weight: var(--font-weight-normal);
align-items: center;
padding: .78571429em .92857143em;
border-radius: .28571429rem;
}

#navbar .item {
min-height: 36px;
min-width: 36px;
Expand All @@ -33,10 +47,6 @@
display: flex;
}

#navbar > .menu > .item {
color: var(--color-nav-text);
}

#navbar .dropdown .item {
justify-content: stretch;
}
Expand Down
0