Added conditional logic to prevent checkmark from appearing on other selects outside of types.

This commit is contained in:
Conor Webb 2023-10-30 12:17:36 +00:00
parent 8f5646a1ed
commit e9f0baa12f
1 changed files with 16 additions and 8 deletions

View File

@ -286,7 +286,8 @@
{#each tables as table} {#each tables as table}
<li <li
class="spectrum-Menu-item" class="spectrum-Menu-item"
class:is-selected={value.label === table.label} class:is-selected={value?.label === table.label &&
value?.type === table.type}
role="option" role="option"
aria-selected="true" aria-selected="true"
tabindex="0" tabindex="0"
@ -314,7 +315,8 @@
{#each views as view} {#each views as view}
<li <li
class="spectrum-Menu-item" class="spectrum-Menu-item"
class:is-selected={value.label === view.label} class:is-selected={value?.label === view.label &&
value?.type === view.type}
role="option" role="option"
aria-selected="true" aria-selected="true"
tabindex="0" tabindex="0"
@ -343,7 +345,8 @@
{#each queries as query} {#each queries as query}
<li <li
class="spectrum-Menu-item" class="spectrum-Menu-item"
class:is-selected={value.label === query.label} class:is-selected={value?.label === query.label &&
value?.type === query.type}
role="option" role="option"
aria-selected="true" aria-selected="true"
tabindex="0" tabindex="0"
@ -372,7 +375,8 @@
{#each links as link} {#each links as link}
<li <li
class="spectrum-Menu-item" class="spectrum-Menu-item"
class:is-selected={value.label === link.label} class:is-selected={value?.label === link.label &&
value?.type === link.type}
role="option" role="option"
aria-selected="true" aria-selected="true"
tabindex="0" tabindex="0"
@ -401,7 +405,8 @@
{#each fields as field} {#each fields as field}
<li <li
class="spectrum-Menu-item" class="spectrum-Menu-item"
class:is-selected={value.label === field.label} class:is-selected={value?.label === field.label &&
value?.type === field.type}
role="option" role="option"
aria-selected="true" aria-selected="true"
tabindex="0" tabindex="0"
@ -430,7 +435,8 @@
{#each jsonArrays as field} {#each jsonArrays as field}
<li <li
class="spectrum-Menu-item" class="spectrum-Menu-item"
class:is-selected={value.label === field.label} class:is-selected={value?.label === field.label &&
value?.type === field.type}
role="option" role="option"
aria-selected="true" aria-selected="true"
tabindex="0" tabindex="0"
@ -459,7 +465,8 @@
{#each dataProviders as provider} {#each dataProviders as provider}
<li <li
class="spectrum-Menu-item" class="spectrum-Menu-item"
class:is-selected={value.label === provider.label} class:is-selected={value?.label === provider.label &&
value?.type === provider.type}
role="option" role="option"
aria-selected="true" aria-selected="true"
tabindex="0" tabindex="0"
@ -486,7 +493,8 @@
<ul class="spectrum-Menu" role="listbox"> <ul class="spectrum-Menu" role="listbox">
<li <li
class="spectrum-Menu-item" class="spectrum-Menu-item"
class:is-selected={value.label === custom.label} class:is-selected={value?.label === custom.label &&
value?.type === custom.type}
role="option" role="option"
aria-selected="true" aria-selected="true"
tabindex="0" tabindex="0"