Fixes workflow selector keyboard navigation (#1514)

Fixes #1387

### Context

While checking some other keyboard navigation issues, I found that I was
unable to create a crawl workflow using only keyboard navigation. This
PR fixes that!

### Changes
- Changes from `<div>`s to `<button>`s so that these can be selected
with tab and enter.
- Adds tabindex for correct selection of items
- Removes the H3 & combines with window title
- Adds width and height to image and width to its container, should make
for a more stable layout while loading (#1387)
This commit is contained in:
Henry Wilkinson 2024-02-07 18:11:20 -05:00 committed by GitHub
parent 9c2228aa52
commit 3982064636
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -41,9 +41,14 @@ export class NewWorkflowDialog extends LitElement {
}
.jobTypeButton {
padding: 0.25rem;
display: block;
width: min-content;
width: 16.5rem;
cursor: pointer;
background: none;
text-align: left;
border: none;
border-radius: 0.75rem;
}
figure {
@ -56,6 +61,8 @@ export class NewWorkflowDialog extends LitElement {
}
.jobTypeImg {
width: 100%;
max-height: 9rem;
transition-property: transform;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-duration: 150ms;
@ -72,14 +79,13 @@ export class NewWorkflowDialog extends LitElement {
render() {
return html`
<btrix-dialog
.label=${msg("Create a New Crawl Workflow")}
.label=${msg("Choose New Workflow Type")}
.open=${this.open}
style="--width: 46rem"
>
<h3 class="title heading">${msg("Choose Crawl Type")}</h3>
<div class="container">
<div
role="button"
<button
tabindex="2"
class="jobTypeButton"
@click=${() => {
this.dispatchEvent(
@ -100,9 +106,9 @@ export class NewWorkflowDialog extends LitElement {
</p>
</figcaption>
</figure>
</div>
<div
role="button"
</button>
<button
tabindex="1"
class="jobTypeButton"
@click=${() => {
this.dispatchEvent(
@ -124,7 +130,7 @@ export class NewWorkflowDialog extends LitElement {
</figcaption>
</figure>
</div>
</div>
</button>
</btrix-dialog>
`;
}