pr feedback
This commit is contained in:
parent
58b6968a12
commit
06a2fcb246
2 changed files with 11 additions and 8 deletions
|
@ -26,7 +26,11 @@
|
||||||
export let fullwidth = false;
|
export let fullwidth = false;
|
||||||
export let border = false;
|
export let border = false;
|
||||||
export let title: string | undefined = '';
|
export let title: string | undefined = '';
|
||||||
export let ref: HTMLButtonElement | null = null;
|
export const focus = () => {
|
||||||
|
ref.focus;
|
||||||
|
};
|
||||||
|
|
||||||
|
let ref: HTMLButtonElement;
|
||||||
|
|
||||||
const colorClasses: Record<Color, string> = {
|
const colorClasses: Record<Color, string> = {
|
||||||
primary:
|
primary:
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
let { isViewing: showAssetViewer } = assetViewingStore;
|
let { isViewing: showAssetViewer } = assetViewingStore;
|
||||||
let choosePersonToMerge = false;
|
let choosePersonToMerge = false;
|
||||||
let changeFocus = false;
|
let changeFocus = false;
|
||||||
let buttonNo: HTMLButtonElement;
|
let focusButtonNo: () => void;
|
||||||
let buttonYes: HTMLButtonElement;
|
let focusButtonYes: () => void;
|
||||||
|
|
||||||
const title = personMerge2.name;
|
const title = personMerge2.name;
|
||||||
|
|
||||||
|
@ -30,15 +30,14 @@
|
||||||
|
|
||||||
const handleKeyboardPress = (event: KeyboardEvent) => {
|
const handleKeyboardPress = (event: KeyboardEvent) => {
|
||||||
if (!$showAssetViewer) {
|
if (!$showAssetViewer) {
|
||||||
event.stopPropagation();
|
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
case 'Tab':
|
case 'Tab':
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
if (changeFocus) {
|
if (changeFocus) {
|
||||||
buttonYes.focus();
|
focusButtonYes();
|
||||||
} else {
|
} else {
|
||||||
buttonNo.focus();
|
focusButtonNo();
|
||||||
}
|
}
|
||||||
|
|
||||||
changeFocus = !changeFocus;
|
changeFocus = !changeFocus;
|
||||||
|
@ -144,8 +143,8 @@
|
||||||
<p class="text-sm text-gray-500 dark:text-gray-300">They will be merged together</p>
|
<p class="text-sm text-gray-500 dark:text-gray-300">They will be merged together</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-8 flex w-full gap-4 px-4 pb-4">
|
<div class="mt-8 flex w-full gap-4 px-4 pb-4">
|
||||||
<Button bind:ref={buttonNo} color="gray" fullwidth on:click={() => dispatch('reject')}>No</Button>
|
<Button bind:focus={focusButtonNo} color="gray" fullwidth on:click={() => dispatch('reject')}>No</Button>
|
||||||
<Button bind:ref={buttonYes} fullwidth on:click={() => dispatch('confirm', [personMerge1, personMerge2])}
|
<Button bind:focus={focusButtonYes} fullwidth on:click={() => dispatch('confirm', [personMerge1, personMerge2])}
|
||||||
>Yes</Button
|
>Yes</Button
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue