Skip to content

Commit

Permalink
Update dropdown styles (#532)
Browse files Browse the repository at this point in the history
Description of changes

Update dropdown styles to match current VS Code styles.

- Rounded corners
- Remove focus highlight from dropdown options
- Remove extra empty space at the bottom of dropdown menu
  • Loading branch information
hawkticehurst authored Dec 6, 2023
1 parent 2ba1428 commit 37bcc86
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
15 changes: 7 additions & 8 deletions src/dropdown/dropdown.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from '@microsoft/fast-foundation';
import {
borderWidth,
cornerRadius,
cornerRadiusRound,
designUnit,
disabledOpacity,
dropdownBackground,
Expand All @@ -34,6 +34,7 @@ export const dropdownStyles = (
) => css`
${display('inline-flex')} :host {
background: ${dropdownBackground};
border-radius: calc(${cornerRadiusRound} * 1px);
box-sizing: border-box;
color: ${foreground};
contain: contents;
Expand All @@ -49,7 +50,7 @@ export const dropdownStyles = (
align-items: center;
box-sizing: border-box;
border: calc(${borderWidth} * 1px) solid ${dropdownBorder};
border-radius: calc(${cornerRadius} * 1px);
border-radius: calc(${cornerRadiusRound} * 1px);
cursor: pointer;
display: flex;
font-family: inherit;
Expand All @@ -62,13 +63,13 @@ export const dropdownStyles = (
.listbox {
background: ${dropdownBackground};
border: calc(${borderWidth} * 1px) solid ${focusBorder};
border-radius: calc(${cornerRadius} * 1px);
border-radius: calc(${cornerRadiusRound} * 1px);
box-sizing: border-box;
display: inline-flex;
flex-direction: column;
left: 0;
max-height: ${dropdownListMaxHeight};
padding: 0 0 calc(${designUnit} * 1px) 0;
padding: 0;
overflow-y: auto;
position: absolute;
width: 100%;
Expand All @@ -86,7 +87,7 @@ export const dropdownStyles = (
}
:host(:${focusVisible}) ::slotted([aria-selected="true"][role="option"]:not([disabled])) {
background: ${listActiveSelectionBackground};
border: calc(${borderWidth} * 1px) solid ${focusBorder};
border: calc(${borderWidth} * 1px) solid transparent;
color: ${listActiveSelectionForeground};
}
:host([disabled]) {
Expand All @@ -111,12 +112,10 @@ export const dropdownStyles = (
:host([open]) .control {
border-color: ${focusBorder};
}
:host([open][position='above']) .listbox,
:host([open][position='below']) .control {
:host([open][position='above']) .listbox {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
:host([open][position='above']) .control,
:host([open][position='below']) .listbox {
border-top-left-radius: 0;
border-top-right-radius: 0;
Expand Down
4 changes: 2 additions & 2 deletions src/option/option.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const optionStyles = (
}
:host([aria-selected='true']) {
background: ${listActiveSelectionBackground};
border: calc(${borderWidth} * 1px) solid ${focusBorder};
border: calc(${borderWidth} * 1px) solid transparent;
color: ${listActiveSelectionForeground};
}
:host(:active) {
Expand All @@ -60,7 +60,7 @@ export const optionStyles = (
}
:host(:not([aria-selected='true']):hover) {
background: ${listActiveSelectionBackground};
border: calc(${borderWidth} * 1px) solid ${focusBorder};
border: calc(${borderWidth} * 1px) solid transparent;
color: ${listActiveSelectionForeground};
}
:host(:not([aria-selected='true']):active) {
Expand Down

0 comments on commit 37bcc86

Please sign in to comment.