Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor focus borders on keyboard navigation #10462

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions react-common/styles/onboarding/TeachingBubble.less
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@
}
}

.common-button:focus-visible {
outline: 2px solid var(--pxt-tertiary-foreground);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you experiment with var(--pxt-focus-border) for this color? Ideally, we'd use that in most cases where we're showing focus like this. If it means we have to change the color --pxt-focus-border is set to, that's definitely an option.

outline-offset: 3px;
}

&.no-steps {
flex-direction: row-reverse;
}
Expand Down
13 changes: 11 additions & 2 deletions theme/accessibility.less
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,17 @@
}

/* Toggle focus */
#mainmenu .editor-menuitem .ui.item:focus {
background: rgba(0,0,0,0.1) !important;
#mainmenu .editor-menuitem {
.ui.item:focus-visible {
background: transparent;
outline: 3px solid white;
outline-offset: -5px;
filter: none;
}

.ui.item.active:focus-visible {
outline-color: black;
}
}

.ui.item:focus, .ui.button:focus {
Expand Down
33 changes: 31 additions & 2 deletions theme/common.less
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,10 @@ pre {
}
}

.editor-sidebar .simtoolbar .ui.button:focus-visible {
outline: @editorFocusBorderSize solid var(--pxt-focus-border);
}

#downloadArea {
margin: unset;

Expand All @@ -249,6 +253,13 @@ pre {
}
}

#downloadArea .button:focus-visible,
#editortools .button:focus-visible
{
outline: @editorFocusBorderSize solid var(--pxt-focus-border);
outline-offset: 2px;
}

#editorToolbarArea {
margin: 0;
margin-left: auto;
Expand All @@ -275,7 +286,7 @@ pre {
color: var(--pxt-primary-foreground) !important; // override !important in semantic ui
border-radius: inherit;

&:hover, &:focus {
&:hover {
background: var(--pxt-primary-background-hover) !important;
color: var(--pxt-primary-foreground-hover) !important;
}
Expand Down Expand Up @@ -373,7 +384,7 @@ div.simframe > iframe {
.menubar .ui.menu.fixed .ui.item.editor-menuitem .item.link:hover {
background: none;
}
.menubar .ui.menu.fixed .ui.item.editor-menuitem .item:not(.active) {
.menubar .ui.menu.fixed .ui.item.editor-menuitem .item:not(.active) * {
opacity: 0.8;
}
.menubar .ui.menu.inverted.fixed .ui.item.editor-menuitem .active.item {
Expand Down Expand Up @@ -462,6 +473,15 @@ div.simframe > iframe {
border-top-right-radius: 0!important;
border-bottom-right-radius: 0!important;
}

.base-menuitem:focus-visible {
outline: 3px solid white;
outline-offset: -5px;
}

.base-menuitem.active:focus-visible {
outline-color: var(--pxt-target-stencil1);
}
}

#editordropdown {
Expand Down Expand Up @@ -693,6 +713,10 @@ div.simframe > iframe {
&:focus {
opacity: 1;
}

&:focus-visible {
outline: @editorFocusBorderSize solid var(--pxt-focus-border);
}
}
#computertogglesim,
#sidedocstoggle {
Expand Down Expand Up @@ -1297,6 +1321,11 @@ Field editors
}
}

#serialPreview .label:focus {
outline: 3px solid var(--pxt-focus-border) !important;
outline-offset: -15px;
}

/*******************************
Layout Variables
*******************************/
Expand Down
20 changes: 17 additions & 3 deletions theme/highcontrast.less
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
#monacoEditor .blocklyTreeRow,
#monacoEditor .monacoDraggableBlock {
&:focus, &:hover {
outline: 2px solid @selected !important;
outline: @editorFocusBorderSize solid @selected !important;
}
}

Expand Down Expand Up @@ -91,6 +91,16 @@
}
}

#editortoggle .active.item {
transition: none;
&:focus {
box-shadow: inset 0 0 0 6px @HCbackground !important;
}
>.icon {
color: @HCbackground !important;
}
}

@media all and (pointer:coarse) { /* If touch screen */
*[tabindex='0'],
*[tabindex*='d1'],
Expand All @@ -102,7 +112,7 @@
#monacoEditor .blocklyTreeRow,
#monacoEditor .monacoDraggableBlock {
&:focus, &:hover {
outline: 1px solid transparent !important;
outline: @editorFocusBorderSize solid transparent !important;
}
}
}
Expand Down Expand Up @@ -356,7 +366,7 @@

&:focus, &:hover {
color: @HCtextColor !important;
border-color: @selected !important;
outline: @editorFocusBorderSize solid @selected;
background: @HCbackground !important;

i, span {
Expand Down Expand Up @@ -646,6 +656,10 @@
&:hover {
border-color: darken(@HCtextColor, 10.0) !important;
}
&:focus {
outline: 3px solid @selected !important;
outline-offset: -15px;
}
}

.ui.button.labeled.icon.editorBack {
Expand Down
6 changes: 6 additions & 0 deletions theme/themes/pxt/globals/site.variables
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,12 @@
/* Detail view */
@homeSelectedCardBorderSize: @homeCardBorderSize*2;
@homeHeaderBorderSize: 3px;

/*-------------------
Editor
--------------------*/
@editorFocusBorderSize: 4px;

/*-------------------
Tutorial
--------------------*/
Expand Down