summaryrefslogtreecommitdiff
path: root/odoo/tools/view_validation.py
diff options
context:
space:
mode:
authorkujiu <kujiu@users.noreply.github.com>2018-07-04 09:55:52 +0200
committerGitHub <noreply@github.com>2018-07-04 09:55:52 +0200
commitf90cf060a3cfeb37a67bec83264c0aaab8892b56 (patch)
treefb92375b6d60293cdb49fe2e61fc20bddcd30940 /odoo/tools/view_validation.py
parentad0f8fd0b7a468538dfb3bb8c08743913b886e78 (diff)
[FIX] Syntax of icons (#25577)
Description of the issue/feature this PR addresses: Accessibility improvements forbids the use of the syntax `<i class="fa fa-check"/> Some text` to create a labelled icon. But, by this, some fonts are changed. Desired behavior after PR is merged: The old syntax can be used.
Diffstat (limited to 'odoo/tools/view_validation.py')
-rw-r--r--odoo/tools/view_validation.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/odoo/tools/view_validation.py b/odoo/tools/view_validation.py
index 7c69906220d..4932b026310 100644
--- a/odoo/tools/view_validation.py
+++ b/odoo/tools/view_validation.py
@@ -155,6 +155,12 @@ def valid_alternative_icon_text(arch):
xpath += '[not(descendant-or-self::field)]'
# And finally, if there is some text, it's good too
xpath += '[not(descendant-or-self::*[text()])]'
+ # Following or preceding text
+ xpath += '[not(preceding-sibling::text()[normalize-space()])]'
+ xpath += '[not(following-sibling::text()[normalize-space()])]'
+ # Following or preceding text in span
+ xpath += '[not(preceding-sibling::span[text()])]'
+ xpath += '[not(following-sibling::span[text()])]'
if arch.xpath(xpath):
return "Warning"
@@ -188,6 +194,12 @@ def valid_title_icon(arch):
xpath += '[not(descendant-or-self::field)]'
# And finally, if there is some text, it's good too
xpath += '[not(descendant-or-self::*[text()])]'
+ # Following or preceding text
+ xpath += '[not(preceding-sibling::text()[normalize-space()])]'
+ xpath += '[not(following-sibling::text()[normalize-space()])]'
+ # Following or preceding text in span
+ xpath += '[not(preceding-sibling::span[text()])]'
+ xpath += '[not(following-sibling::span[text()])]'
if arch.xpath(xpath):
return "Warning"