From 7dd0b79ad9e7949ce205372a0d0dd145a1689b37 Mon Sep 17 00:00:00 2001 From: Ross Keenan Date: Mon, 29 Nov 2021 08:31:21 +0200 Subject: [PATCH] feat(List/Matrix View): :sparkles: Show the common-parent of an implied sibling as an aria-label (on hover) (#81) --- src/Components/Lists.svelte | 1 + src/Components/Matrix.svelte | 1 + src/MatrixView.ts | 9 +++++++-- src/interfaces.ts | 1 + 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Components/Lists.svelte b/src/Components/Lists.svelte index 73d71c6e..799c187c 100644 --- a/src/Components/Lists.svelte +++ b/src/Components/Lists.svelte @@ -60,6 +60,7 @@ openOrSwitch(app, impliedItem.to, e)} on:mouseover={(e) => hoverPreview(e, matrixView, impliedItem.to)} + aria-label={impliedItem.parent ?? ""} > {impliedItem.alt ?? impliedItem.to.split("/").last()} diff --git a/src/Components/Matrix.svelte b/src/Components/Matrix.svelte index 3f695f02..b1f79082 100644 --- a/src/Components/Matrix.svelte +++ b/src/Components/Matrix.svelte @@ -60,6 +60,7 @@ openOrSwitch(app, impliedItem.to, e)} on:mouseover={(e) => hoverPreview(e, matrixView, impliedItem.to)} + aria-label={impliedItem.parent ?? ""} > {impliedItem.alt ?? impliedItem.to.split("/").last()} diff --git a/src/MatrixView.ts b/src/MatrixView.ts index 96badd5e..970aa811 100644 --- a/src/MatrixView.ts +++ b/src/MatrixView.ts @@ -82,12 +82,17 @@ export default class MatrixView extends ItemView { return alt; } - toInternalLinkObj = (to: string, realQ = true) => { + toInternalLinkObj = ( + to: string, + realQ = true, + parent?: string + ): internalLinkObj => { return { to, cls: linkClass(this.app, to, realQ), alt: this.getAlt(to, this.plugin.settings), order: this.getOrder(to), + parent, }; }; @@ -173,7 +178,7 @@ export default class MatrixView extends ItemView { }); impliedSiblings.forEach((impliedSibling) => { - iSameArr.push(this.toInternalLinkObj(impliedSibling, false)); + iSameArr.push(this.toInternalLinkObj(impliedSibling, false, parent)); }); }); diff --git a/src/interfaces.ts b/src/interfaces.ts index ed2bc30c..2ada53ea 100644 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -130,6 +130,7 @@ export interface internalLinkObj { cls: string; alt: string | null; order: number; + parent?: string; } export interface SquareProps {