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