Skip to content

Commit

Permalink
Merge branch 'fix-area-href' into 'main'
Browse files Browse the repository at this point in the history
Allow opening links on area tags

See merge request web/clients!5790

Changelog:
  • Loading branch information
MargeBot committed Jul 13, 2023
2 parents 50e7cf0 + 2f8a7b3 commit d04bb1e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/components/hooks/useLinkHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const useLinkHandler: UseLinkHandler = (
// eslint-disable-next-line @typescript-eslint/no-misused-promises
const handleClick = useHandler(async (event: Event) => {
const originalTarget = event.target as Element;
const target = originalTarget.closest('a');
const target = originalTarget.closest('a') || originalTarget.closest('area');

if (!target) {
return;
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/lib/sanitize/purify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const toMap = (list: string[]) =>

const LIST_PROTON_ATTR = ['data-src', 'src', 'srcset', 'background', 'poster', 'xlink:href', 'href'];
const MAP_PROTON_ATTR = toMap(LIST_PROTON_ATTR);
const PROTON_ATTR_TAG_WHITELIST = ['a', 'base'];
const PROTON_ATTR_TAG_WHITELIST = ['a', 'base', 'area'];
const MAP_PROTON_ATTR_TAG_WHITELIST = toMap(PROTON_ATTR_TAG_WHITELIST.map((tag) => tag.toUpperCase()));

const shouldPrefix = (tagName: string, attributeName: string) => {
Expand Down

0 comments on commit d04bb1e

Please sign in to comment.