diff options
| author | kujiu <kujiu@users.noreply.github.com> | 2018-07-04 09:55:52 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-07-04 09:55:52 +0200 |
| commit | f90cf060a3cfeb37a67bec83264c0aaab8892b56 (patch) | |
| tree | fb92375b6d60293cdb49fe2e61fc20bddcd30940 /odoo | |
| parent | ad0f8fd0b7a468538dfb3bb8c08743913b886e78 (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')
| -rw-r--r-- | odoo/addons/base/tests/test_view_validation.py | 3 | ||||
| -rw-r--r-- | odoo/tools/view_validation.py | 12 |
2 files changed, 15 insertions, 0 deletions
diff --git a/odoo/addons/base/tests/test_view_validation.py b/odoo/addons/base/tests/test_view_validation.py index c3ac8020c27..5e550414436 100644 --- a/odoo/addons/base/tests/test_view_validation.py +++ b/odoo/addons/base/tests/test_view_validation.py @@ -71,12 +71,15 @@ valid_form = etree.parse(io.BytesIO(b'''\ <span class="fa fa-success" aria-label="Test span" title="Test span"/> <a class="fa fa-success"><span aria-label="test" title="test"/></a> <a class="btn" role="button"/> + <i class="fa fa-check"/> Test icon + <i class="fa fa-check"/> </group> </page> </notebook> <div role="dialog" class="modal"> <header class="modal-header"/> <main class="modal-body"/> + <i class="fa fa-check"/> <span>Test</span> <footer class="modal-footer"/> </div> <div class="tab-pane" role="tabpanel"/> 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" |
