UX: Show titles on site settings navigation menu items (#20794)

In some languages, labels on the site settings navigation menu 
get truncated. This adds titles to menu items, so users can see 
untruncated labels on hover.
This commit is contained in:
Andrei Prigorshnev 2023-03-24 20:46:10 +04:00 committed by GitHub
parent bc8ab33708
commit 19b0dbe59d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 3 deletions

View File

@ -37,11 +37,12 @@
@route="adminSiteSettingsCategory" @route="adminSiteSettingsCategory"
@model={{category.nameKey}} @model={{category.nameKey}}
class={{category.nameKey}} class={{category.nameKey}}
title={{category.name}}
> >
{{category.name}} {{category.name}}
{{#if category.count}}<span {{#if category.count}}
class="count" <span class="count">({{category.count}})</span>
>({{category.count}})</span>{{/if}} {{/if}}
</LinkTo> </LinkTo>
</li> </li>
{{/each}} {{/each}}

View File

@ -3,6 +3,7 @@ import {
count, count,
exists, exists,
query, query,
queryAll,
} from "discourse/tests/helpers/qunit-helpers"; } from "discourse/tests/helpers/qunit-helpers";
import { import {
click, click,
@ -190,4 +191,17 @@ acceptance("Admin - Site Settings", function (needs) {
"blocked_onebox_domains=proper.com" "blocked_onebox_domains=proper.com"
); );
}); });
test("nav menu items have titles", async (assert) => {
await visit("/admin/site_settings");
const navItems = queryAll(".admin-nav .nav-stacked li a");
navItems.each((_, item) => {
assert.equal(
item.title,
item.innerText,
"menu item has title, and the title is equal to menu item's label"
);
});
});
}); });