From 979fe21c95d51cba1fb05f75cdd9a130c2475c99 Mon Sep 17 00:00:00 2001 From: Cosmin Popovici Date: Sat, 24 Jun 2023 18:42:53 +0300 Subject: [PATCH] refactor: prefer role none over presentation --- src/transformers/extraAttributes.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/transformers/extraAttributes.js b/src/transformers/extraAttributes.js index c4725f13..2fc8f2ab 100644 --- a/src/transformers/extraAttributes.js +++ b/src/transformers/extraAttributes.js @@ -14,14 +14,20 @@ module.exports = async (html, config = {}, direct = false) => { table: { cellpadding: 0, cellspacing: 0, - role: 'presentation' + role: 'none' }, img: { alt: '' } } - attributes = direct ? {...attributes, ...config} : (isObject(config.extraAttributes) ? {...attributes, ...config.extraAttributes} : attributes) + attributes = direct + ? {...attributes, ...config} + : ( + isObject(config.extraAttributes) + ? {...attributes, ...config.extraAttributes} + : attributes + ) return posthtml([addAttributes({attributes})]).process(html, posthtmlOptions).then(result => result.html) }