Skip to content

Commit

Permalink
fix external link aria-label getting replaced.
Browse files Browse the repository at this point in the history
  • Loading branch information
EliasKau committed Sep 7, 2023
1 parent e6e0df8 commit 0580cf2
Show file tree
Hide file tree
Showing 6 changed files with 258 additions and 333 deletions.
48 changes: 24 additions & 24 deletions js/dev/front-end.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/dev/gutenberg-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
\************************************/
/***/ (() => {

eval("/**\n * @Author: Roni Laukkarinen\n * @Date: 2022-02-11 15:38:14\n * @Last Modified by: Roni Laukkarinen\n * @Last Modified time: 2022-09-29 13:53:14\n */\n// Declare the blocks you'd like to style.\n// eslint-disable-next-line\nwp.blocks.registerBlockStyle('core/paragraph', {\n name: 'boxed',\n label: 'Laatikko'\n});\n\n// When document is ready as in when blocks are fully loaded\nwindow.addEventListener('load', function () {\n /**\n * initializeBlock\n *\n * Adds custom JavaScript to the block HTML.\n *\n * @date 15/4/19\n * @since 1.0.0\n *\n * @param object $block The block jQuery element.\n * @param object attributes The block attributes (only available when editing).\n * @return void\n *\n * @source https://www.advancedcustomfields.com/resources/acf_register_block_type/\n */\n // eslint-disable-next-line\n var initializeBlock = function initializeBlock($block) {\n // Your scripts here\n };\n\n // Initialize dynamic block preview (editor).\n if (window.acf) {\n window.acf.addAction('render_block_preview', initializeBlock);\n }\n});\n\n//# sourceURL=webpack://air-light/./js/src/gutenberg-editor.js?");
eval("/**\n * @Author: Roni Laukkarinen\n * @Date: 2022-02-11 15:38:14\n * @Last Modified by: Roni Laukkarinen\n * @Last Modified time: 2022-09-29 13:53:14\n */\n// Declare the blocks you'd like to style.\n// eslint-disable-next-line\nwp.blocks.registerBlockStyle('core/paragraph', {\n name: 'boxed',\n label: 'Laatikko'\n}); // When document is ready as in when blocks are fully loaded\n\nwindow.addEventListener('load', function () {\n /**\n * initializeBlock\n *\n * Adds custom JavaScript to the block HTML.\n *\n * @date 15/4/19\n * @since 1.0.0\n *\n * @param object $block The block jQuery element.\n * @param object attributes The block attributes (only available when editing).\n * @return void\n *\n * @source https://www.advancedcustomfields.com/resources/acf_register_block_type/\n */\n // eslint-disable-next-line\n var initializeBlock = function initializeBlock($block) {// Your scripts here\n }; // Initialize dynamic block preview (editor).\n\n\n if (window.acf) {\n window.acf.addAction('render_block_preview', initializeBlock);\n }\n});\n\n//# sourceURL=webpack://air-light/./js/src/gutenberg-editor.js?");

/***/ })

Expand Down
527 changes: 225 additions & 302 deletions js/dev/legacy.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/prod/front-end.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/prod/legacy.js

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions js/src/modules/external-link.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
/**
* @Author: Roni Laukkarinen
* @Date: 2021-09-01 11:55:37
* @Last Modified by: Roni Laukkarinen
* @Last Modified time: 2022-10-31 16:23:45
* @Last Modified by: Elias Kautto
* @Last Modified time: 2023-09-07 12:13:08
*/
/**
* Style external links
Expand Down Expand Up @@ -101,8 +101,10 @@ export function styleExternalLinks() {
if (!externalLink.classList.contains('no-external-link-label')) {
const textContent = externalLink.textContent.trim().length
? externalLink.textContent.trim() : getChildAltText(externalLink);
const ariaLabel = externalLink.target === '_blank' ? `${textContent}: ${getLocalization('external_link')}, ${getLocalization('target_blank')}` : `${textContent}: ${getLocalization('external_link')}`;
externalLink.setAttribute('aria-label', ariaLabel);
if (textContent && !externalLink.getAttribute('aria-label')) {
const ariaLabel = externalLink.target === '_blank' ? `${textContent}: ${getLocalization('external_link')}, ${getLocalization('target_blank')}` : `${textContent}: ${getLocalization('external_link')}`;
externalLink.setAttribute('aria-label', ariaLabel);
}
}

// Arrow icon won't be added if one of these classes is defined for the link
Expand Down

0 comments on commit 0580cf2

Please sign in to comment.