DEV: Make breadcrumb separators unclickable icons (#29817)

The current breadcrumb separators are ">" characters that are added as pseudo-elements. These become part of the clickable area for the links, which causes mis-clicks.

This PR does two things:

- Replace the pseudo-element with a DIcon.
- Make sure the separator is not clickable.
This commit is contained in:
Ted Johansson 2024-11-19 16:42:43 +08:00 committed by GitHub
parent d96b8d1001
commit c3367c329c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 6 deletions

View File

@ -1,5 +1,6 @@
import Component from "@glimmer/component"; import Component from "@glimmer/component";
import { service } from "@ember/service"; import { service } from "@ember/service";
import icon from "discourse-common/helpers/d-icon";
import getURL from "discourse-common/lib/get-url"; import getURL from "discourse-common/lib/get-url";
export default class DBreadcrumbsItem extends Component { export default class DBreadcrumbsItem extends Component {
@ -26,6 +27,9 @@ export default class DBreadcrumbsItem extends Component {
<a href={{getURL path}} class={{@linkClass}}> <a href={{getURL path}} class={{@linkClass}}>
{{label}} {{label}}
</a> </a>
<span class="separator">
{{~icon "angle-right"~}}
</span>
</li> </li>
</template>; </template>;
} }

View File

@ -11,11 +11,20 @@
color: var(--primary-medium); color: var(--primary-medium);
} }
li:not(:last-child) a::after { li {
display: inline; .separator {
padding: 0 var(--space-1); margin-right: var(--space-1);
margin-right: var(--space-1);
font-size: var(--font-down-1); .d-icon {
content: ">"; color: var(--primary-medium);
font-size: var(--font-down-1);
}
}
}
li:last-child {
.separator {
display: none;
}
} }
} }