Add tooltips for MD editor buttons and add `muted` class for buttons (#23896)

Followup of #23876 according to my unreleased review demanding tooltips.
Additionally
- add a `muted` equivalent for buttons
- convert `switch to legacy` to an actual button
- enroll `switch to legacy` in the builtin pseudo focus cycle
- remove spaces between the buttons

The effect of the `muted` class is what you would expect: The button
loses all of its normal styling, and is defined only by its content instead.
This will help reduce a11y infractions in the future, as that was one of
the major points why people didn't use `<button>` tags and decided on a
bad fix (i.e. through `<div>`s) instead.

## Appearance

![image](https://user-images.githubusercontent.com/51889757/229510842-337378e5-faa5-4886-a910-08614c0c233d.png)

---------

Co-authored-by: silverwind <me@silverwind.io>
pull/24046/head
delvh 2 years ago committed by GitHub
parent 7a8a4f5432
commit 91c8261e2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      options/locale/locale_en-US.ini
  2. 29
      templates/shared/combomarkdowneditor.tmpl
  3. 16
      web_src/css/base.css
  4. 3
      web_src/css/editor-markdown.css

@ -120,6 +120,20 @@ footer = Footer
footer.software = About Software footer.software = About Software
footer.links = Links footer.links = Links
[editor]
buttons.heading.tooltip = Add heading
buttons.bold.tooltip = Add bold text
buttons.italic.tooltip = Add italic text
buttons.quote.tooltip = Quote text
buttons.code.tooltip = Add code
buttons.link.tooltip = Add a link
buttons.list.unordered.tooltip = Add a bullet list
buttons.list.ordered.tooltip = Add a numbered list
buttons.list.task.tooltip = Add a list of tasks
buttons.mention.tooltip = Mention a user or team
buttons.ref.tooltip = Reference an issue or pull request
buttons.switch_to_legacy.tooltip = Use the legacy editor instead
[filter] [filter]
string.asc = A - Z string.asc = A - Z
string.desc = Z - A string.desc = Z - A

@ -19,29 +19,28 @@ Template Attributes:
</div> </div>
{{end}} {{end}}
<div class="ui tab active" data-tab-panel="markdown-writer"> <div class="ui tab active" data-tab-panel="markdown-writer">
<markdown-toolbar class="gt-df"> <markdown-toolbar class="gt-df gt-ac gt-gap-3">
<div class="markdown-toolbar-group"> <div class="markdown-toolbar-group">
<md-header class="markdown-toolbar-button">{{svg "octicon-heading"}}</md-header> <md-header role="button" class="markdown-toolbar-button btn-link muted" data-tooltip-content="{{.locale.Tr "editor.buttons.heading.tooltip"}}">{{svg "octicon-heading"}}</md-header>
<md-bold class="markdown-toolbar-button">{{svg "octicon-bold"}}</md-bold> <md-bold role="button" class="markdown-toolbar-button btn-link muted" data-tooltip-content="{{.locale.Tr "editor.buttons.bold.tooltip"}}">{{svg "octicon-bold"}}</md-bold>
<md-italic class="markdown-toolbar-button">{{svg "octicon-italic"}}</md-italic> <md-italic role="button" class="markdown-toolbar-button btn-link muted" data-tooltip-content="{{.locale.Tr "editor.buttons.italic.tooltip"}}">{{svg "octicon-italic"}}</md-italic>
</div> </div>
<div class="markdown-toolbar-group"> <div class="markdown-toolbar-group">
<md-quote class="markdown-toolbar-button">{{svg "octicon-quote"}}</md-quote> <md-quote role="button" class="markdown-toolbar-button btn-link muted" data-tooltip-content="{{.locale.Tr "editor.buttons.quote.tooltip"}}">{{svg "octicon-quote"}}</md-quote>
<md-code class="markdown-toolbar-button">{{svg "octicon-code"}}</md-code> <md-code role="button" class="markdown-toolbar-button btn-link muted" data-tooltip-content="{{.locale.Tr "editor.buttons.code.tooltip"}}">{{svg "octicon-code"}}</md-code>
<md-link class="markdown-toolbar-button">{{svg "octicon-link"}}</md-link> <md-link role="button" class="markdown-toolbar-button btn-link muted" data-tooltip-content="{{.locale.Tr "editor.buttons.link.tooltip"}}">{{svg "octicon-link"}}</md-link>
</div> </div>
<div class="markdown-toolbar-group"> <div class="markdown-toolbar-group">
<md-unordered-list class="markdown-toolbar-button">{{svg "octicon-list-unordered"}}</md-unordered-list> <md-unordered-list role="button" class="markdown-toolbar-button btn-link muted" data-tooltip-content="{{.locale.Tr "editor.buttons.list.unordered.tooltip"}}">{{svg "octicon-list-unordered"}}</md-unordered-list>
<md-ordered-list class="markdown-toolbar-button">{{svg "octicon-list-ordered"}}</md-ordered-list> <md-ordered-list role="button" class="markdown-toolbar-button btn-link muted" data-tooltip-content="{{.locale.Tr "editor.buttons.list.ordered.tooltip"}}">{{svg "octicon-list-ordered"}}</md-ordered-list>
<md-task-list class="markdown-toolbar-button">{{svg "octicon-tasklist"}}</md-task-list> <md-task-list role="button" class="markdown-toolbar-button btn-link muted" data-tooltip-content="{{.locale.Tr "editor.buttons.list.task.tooltip"}}">{{svg "octicon-tasklist"}}</md-task-list>
</div> </div>
<div class="markdown-toolbar-group"> <div class="markdown-toolbar-group">
<md-mention class="markdown-toolbar-button">{{svg "octicon-mention"}}</md-mention> <md-mention role="button" class="markdown-toolbar-button btn-link muted" data-tooltip-content="{{.locale.Tr "editor.buttons.mention.tooltip"}}">{{svg "octicon-mention"}}</md-mention>
<md-ref class="markdown-toolbar-button">{{svg "octicon-cross-reference"}}</md-ref> <md-ref role="button" class="markdown-toolbar-button btn-link muted" data-tooltip-content="{{.locale.Tr "editor.buttons.ref.tooltip"}}">{{svg "octicon-cross-reference"}}</md-ref>
</div> </div>
<div class="markdown-toolbar-group gt-f1"></div> <div class="markdown-toolbar-group gt-f1 gt-je">
<div class="markdown-toolbar-group"> <button class="markdown-toolbar-button markdown-switch-easymde btn-link muted" data-tooltip-content="{{.locale.Tr "editor.buttons.switch_to_legacy.tooltip"}}">{{svg "octicon-arrow-switch"}}</button>
<span class="markdown-toolbar-button markdown-switch-easymde">{{svg "octicon-arrow-switch"}}</span>
</div> </div>
</markdown-toolbar> </markdown-toolbar>
<text-expander keys=": @"> <text-expander keys=": @">

@ -328,14 +328,27 @@ progress::-moz-progress-bar {
user-select: none; user-select: none;
} }
.btn-link {
background: none;
border: none;
color: var(--color-primary);
}
a:hover,
.btn-link:hover {
text-decoration: underline;
}
a, a,
.ui.breadcrumb a { .ui.breadcrumb a,
.btn-link {
color: var(--color-primary); color: var(--color-primary);
cursor: pointer; cursor: pointer;
text-decoration-skip-ink: all; text-decoration-skip-ink: all;
} }
a.muted, a.muted,
.btn-link.muted,
.muted-links a { .muted-links a {
color: inherit; color: inherit;
} }
@ -343,6 +356,7 @@ a.muted,
a:hover, a:hover,
a.muted:hover, a.muted:hover,
a.muted:hover [class*="color-text"], a.muted:hover [class*="color-text"],
.btn-link.muted:hover,
.muted-links a:hover, .muted-links a:hover,
.ui.breadcrumb a:hover { .ui.breadcrumb a:hover {
color: var(--color-primary); color: var(--color-primary);

@ -9,13 +9,12 @@
} }
.combo-markdown-editor .markdown-toolbar-group { .combo-markdown-editor .markdown-toolbar-group {
display: inline-block; display: flex;
} }
.combo-markdown-editor .markdown-toolbar-button { .combo-markdown-editor .markdown-toolbar-button {
user-select: none; user-select: none;
padding: 5px; padding: 5px;
cursor: pointer;
} }
.ui.form .combo-markdown-editor textarea.markdown-text-editor, .ui.form .combo-markdown-editor textarea.markdown-text-editor,

Loading…
Cancel
Save