Additional fixes

This commit is contained in:
Jed Fox 2020-04-01 13:50:09 -04:00
parent e0e1e4fde7
commit 11df3a01e1
No known key found for this signature in database
GPG key ID: 0B61D18EA54B47E1
4 changed files with 8 additions and 5 deletions

View file

@ -3,7 +3,7 @@ import { Popover } from "./Popover";
import "./ColorPicker.scss"; import "./ColorPicker.scss";
import { KEYS } from "../keys"; import { KEYS } from "../keys";
import { t } from "../i18n"; import { t, getLanguage } from "../i18n";
import { isWritableElement } from "../utils"; import { isWritableElement } from "../utils";
import colors from "../colors"; import colors from "../colors";
@ -69,6 +69,7 @@ const Picker = function ({
event.key === KEYS.ARROW_DOWN event.key === KEYS.ARROW_DOWN
) { ) {
const { activeElement } = document; const { activeElement } = document;
const isRTL = getLanguage().rtl;
const index = Array.prototype.indexOf.call( const index = Array.prototype.indexOf.call(
gallery!.current!.children, gallery!.current!.children,
activeElement, activeElement,
@ -76,9 +77,9 @@ const Picker = function ({
if (index !== -1) { if (index !== -1) {
const length = gallery!.current!.children.length - (showInput ? 1 : 0); const length = gallery!.current!.children.length - (showInput ? 1 : 0);
const nextIndex = const nextIndex =
event.key === KEYS.ARROW_RIGHT event.key === (isRTL ? KEYS.ARROW_LEFT : KEYS.ARROW_RIGHT)
? (index + 1) % length ? (index + 1) % length
: event.key === KEYS.ARROW_LEFT : event.key === (isRTL ? KEYS.ARROW_RIGHT : KEYS.ARROW_LEFT)
? (length + index - 1) % length ? (length + index - 1) % length
: event.key === KEYS.ARROW_DOWN : event.key === KEYS.ARROW_DOWN
? (index + 5) % length ? (index + 5) % length

View file

@ -17,7 +17,7 @@
min-width: 9.5rem; min-width: 9.5rem;
margin: 0; margin: 0;
padding: 0.25rem 1rem 0.25rem 1.25rem; padding: 0.25rem 1rem 0.25rem 1.25rem;
text-align: left; text-align: start;
border-radius: 0; border-radius: 0;
background-color: #f2f2f2; background-color: #f2f2f2;
border: none; border: none;

View file

@ -20,7 +20,7 @@
.Dialog { .Dialog {
--metric: calc(var(--space-factor) * 4); --metric: calc(var(--space-factor) * 4);
--inset-left: #{"max(var(--metric), var(--sal))"}; --inset-left: #{"max(var(--metric), var(--sal))"};
--inset-right: #{"max(var(--metric), env(safe-area-inset-right))"}; --inset-right: #{"max(var(--metric), var(--sar))"};
} }
.Dialog__title { .Dialog__title {
grid-template-columns: calc(var(--space-factor) * 7) 1fr calc( grid-template-columns: calc(var(--space-factor) * 7) 1fr calc(

View file

@ -15,6 +15,7 @@
z-index: 2; z-index: 2;
} }
/* TODO: if these are used, make sure to implement RTL support
.FixedSideContainer_side_left { .FixedSideContainer_side_left {
left: var(--margin); left: var(--margin);
top: var(--margin); top: var(--margin);
@ -28,3 +29,4 @@
bottom: var(--margin); bottom: var(--margin);
z-index: 3; z-index: 3;
} }
*/