Skip to content

Commit

Permalink
feat(List/Matrix View): ✨ Show the common-parent of an implied siblin…
Browse files Browse the repository at this point in the history
…g as an aria-label (on hover) (#81)
  • Loading branch information
SkepticMystic committed Nov 29, 2021
1 parent dcb221b commit 7dd0b79
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/Components/Lists.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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()}
</div>
Expand Down
1 change: 1 addition & 0 deletions src/Components/Matrix.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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()}
</div>
Expand Down
9 changes: 7 additions & 2 deletions src/MatrixView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
};

Expand Down Expand Up @@ -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));
});
});

Expand Down
1 change: 1 addition & 0 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export interface internalLinkObj {
cls: string;
alt: string | null;
order: number;
parent?: string;
}

export interface SquareProps {
Expand Down

0 comments on commit 7dd0b79

Please sign in to comment.