Skip to content

Commit 08999bd

Browse files
committed
feat(combobox): adding keyboard focused state in readonly
1 parent 534aa28 commit 08999bd

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

.changeset/new-doors-fold.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
"@spectrum-css/combobox": minor
33
---
44

5-
Combobox now includes a `read-only` state. Add the `is-readOnly` class to the Combobox to enable this feature. By doing so, this also activates the `readonly` attribute in the `Textfield` component. To ensure the intended user experience please make sure the readonly state in the textfield is enabled by adding the `is-readOnly` class and `readonly` attribute on the input element for this component as well.
5+
Combobox now includes a `read-only` state. Add the `is-readOnly` class to the Combobox to enable this feature. To ensure the intended user experience, please make sure the readonly state in the textfield is enabled by adding the `is-readOnly` class and `readonly` attribute on the input element for this component as well.

components/combobox/index.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,14 @@
223223
}
224224

225225
&.is-readOnly:not(.spectrum-Combobox--quiet) {
226+
.spectrum-Combobox-textfield {
227+
&.is-keyboardFocused .spectrum-Combobox-input {
228+
outline-offset: var(--mod-textfield-focus-indicator-gap);
229+
outline: var(--mod-textfield-focus-indicator-width) solid;
230+
outline-color: var(--mod-textfield-focus-indicator-color);
231+
}
232+
}
233+
226234
.spectrum-Combobox-input:read-only {
227235
background-color: var(--spectrum-combobox-readonly-input-background-color);
228236
border-color: var(--spectrum-combobox-readonly-input-border-color);

components/combobox/metadata/metadata.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
".spectrum-Combobox.is-readOnly.is-invalid:not(.spectrum-Combobox--quiet) .spectrum-Combobox-input:read-only",
6868
".spectrum-Combobox.is-readOnly:not(.spectrum-Combobox--quiet) .spectrum-Combobox-input:read-only",
6969
".spectrum-Combobox.is-readOnly:not(.spectrum-Combobox--quiet) .spectrum-Combobox-input:read-only:hover",
70+
".spectrum-Combobox.is-readOnly:not(.spectrum-Combobox--quiet) .spectrum-Combobox-textfield.is-keyboardFocused .spectrum-Combobox-input",
7071
".spectrum-Combobox:has(:active) .spectrum-Combobox-button.is-invalid:not(:disabled, .spectrum-PickerButton--quiet)",
7172
".spectrum-Combobox:has(:active) .spectrum-Combobox-button:not(:disabled, .is-invalid, .spectrum-PickerButton--quiet)",
7273
".spectrum-Combobox:has(:focus) .spectrum-Combobox-button.is-invalid:not(:disabled, .spectrum-PickerButton--quiet)",

components/combobox/stories/combobox.stories.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ QuietGroup.parameters = {
171171
};
172172

173173
/**
174-
* Comboboxes have a read-only option for when content in the disabled state still needs to be shown. This allows for content to be copied, but not interacted with or changed. A combobox does not have a read-only option if no selection has been made. To enable this feature, add the `.isReadOnly` class to the combobox. Then within the textfield component, add the `.isReadOnly` class and `readonly` attribute to the `<input>`.
174+
* Comboboxes have a read-only option for when content in the disabled state still needs to be shown. This allows for content to be copied, but not interacted with or changed. A combobox does not have a read-only option if no selection has been made. To enable this feature, add the `.isReadOnly` class to the combobox. To enable this feature, add the .isReadOnly class to the combobox. Then within the nested textfield component, add the .isReadOnly class and readonly attribute to the <input> element.
175175
*/
176176
export const ReadOnly = Template.bind({});
177177
ReadOnly.tags = ["!dev"];

0 commit comments

Comments
 (0)