Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix acessibilidade #140

Merged
merged 5 commits into from
Oct 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ Histórico de Alterações
1.2.2 (unreleased)
^^^^^^^^^^^^^^^^^^

- Nothing changed yet.
- Adiciona CSS para ocultar os links de id acontent, afooter e anavigation.
[idgserpro]

- Adiciona regra Diazo para obter a tradução dos links de id acontent, afooter e anavigation que são gerados via viewlet em brasil.gov.portal.
[idgserpro]


1.2.1 (2017-07-05)
Expand Down
69 changes: 69 additions & 0 deletions src/brasil/gov/temas/tests/test_acessibilidade.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# -*- coding: utf-8 -*-
from brasil.gov.temas.testing import FUNCTIONAL_TESTING
from plone.app.theming.interfaces import IThemeSettings
from plone.app.theming.utils import applyTheme
from plone.app.theming.utils import getTheme
from plone.registry.interfaces import IRegistry
from plone.testing.z2 import Browser
from zope.component import getUtility

import Globals
import transaction
import unittest


class LinksAcessibilidadeTestCase(unittest.TestCase):

layer = FUNCTIONAL_TESTING

def setUp(self):
Globals.DevelopmentMode = True
self.portal = self.layer['portal']
self.settings = getUtility(IRegistry).forInterface(IThemeSettings)
self.browser = Browser(self.layer['app'])
transaction.commit()

def base_test(self, cor):
"""Teste base dos temas."""
theme = getTheme(cor)
applyTheme(theme)
self.settings.enabled = True
transaction.commit()

self.browser.open(self.portal.absolute_url())

# Testa se a âncora para o conteúdo aparece.
self.assertIn(
'<a name="acontent" id="acontent" class="anchor">',
self.browser.contents,
)

# Testa se a âncora para o menu aparece.
self.assertIn(
'<a name="anavigation" id="anavigation" class="anchor">',
self.browser.contents,
)

# Testa se o input para a busca aparece.
self.assertIn(
'name="SearchableText"',
self.browser.contents,
)

# Testa se a âncora para o rodapé aparece.
self.assertIn(
'<a name="afooter" id="afooter" class="anchor">',
self.browser.contents,
)

def test_link_para_conteudo_tema_amarelo(self):
self.base_test('amarelo')

def test_link_para_conteudo_tema_azul(self):
self.base_test('azul')

def test_link_para_conteudo_tema_branco(self):
self.base_test('branco')

def test_link_para_conteudo_tema_verde(self):
self.base_test('verde')
7 changes: 7 additions & 0 deletions src/brasil/gov/temas/themes/amarelo/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ div#wrapper-barra-brasil {
color: #fff;
}

.anchor {
display: block;
font-size: 0;
height: 0;
width: 0;
}

/* Titulo do portal
========================================================================== */

Expand Down
6 changes: 3 additions & 3 deletions src/brasil/gov/temas/themes/amarelo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@

<!-- Column 1 -->
<div id="navigation">
<a name="anavigation" id="anavigation"></a>
<a name="anavigation" id="anavigation" class="anchor">menu</a>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the use of the name attribute is deprecated in HTML5:

https://www.w3.org/TR/html5/obsolete.html#obsolete

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We didn't add this attribute, it was already available in the code. Since removing this is out of the scope of this PR, we're opening a new ticket do address it #141 in another branch.

<span class="menuTrigger">Menu</span>
<div id="portal-column-one" class="cell width-1:4 position-0">

Expand Down Expand Up @@ -302,7 +302,7 @@

<!-- Conteudo -->
<div id="portal-column-content" class="cell width-1:2 position-1:4">
<a name="acontent" id="acontent"></a>
<a name="acontent" id="acontent" class="anchor">conteúdo</a>

<div id="main-content" class="">

Expand Down Expand Up @@ -423,7 +423,7 @@ <h3>Content subheading H3</h3>

<!-- Footer -->
<div id="footer" role="contentinfo">
<a name="afooter" id="afooter"></a>
<a name="afooter" id="afooter" class="anchor">rodapé</a>

<div id="doormat">
Menu do rodape
Expand Down
3 changes: 3 additions & 0 deletions src/brasil/gov/temas/themes/amarelo/rules.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@
<replace css:theme="#voltar-topo" css:content="#voltar-topo" />
<replace css:theme="#extra-footer" css:content="#extra-footer" />
<replace css:theme="#accessibility" css:content="#accessibility" />
<replace css:theme="#acontent" css:content="#acontent" css:if-content="#acontent"/>
<replace css:theme="#anavigation" css:content="#anavigation" css:if-content="#anavigation"/>
<replace css:theme="#afooter" css:content="#afooter" css:if-content="#afooter"/>
<drop css:content="#viewlet-below-content-body" />
<replace css:theme="#barra_brasil_js" css:content-children="#barra_brasil_js" />

Expand Down
6 changes: 6 additions & 0 deletions src/brasil/gov/temas/themes/azul/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ div#wrapper-barra-brasil {
top: 47px;
}

.anchor {
display: block;
font-size: 0;
height: 0;
width: 0;
}

/* Menu de Acessibilidade
========================================================================== */
Expand Down
6 changes: 3 additions & 3 deletions src/brasil/gov/temas/themes/azul/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@

<!-- Column 1 -->
<div id="navigation">
<a name="anavigation" id="anavigation"></a>
<a name="anavigation" id="anavigation" class="anchor">menu</a>
<span class="menuTrigger">Menu</span>
<div id="portal-column-one" class="cell width-1:4 position-0">

Expand Down Expand Up @@ -305,7 +305,7 @@

<!-- Conteudo -->
<div id="portal-column-content" class="cell width-1:2 position-1:4">
<a name="acontent" id="acontent"></a>
<a name="acontent" id="acontent" class="anchor">conteúdo</a>

<div id="main-content" class="">

Expand Down Expand Up @@ -426,7 +426,7 @@ <h3>Content subheading H3</h3>

<!-- Footer -->
<div id="footer" role="contentinfo">
<a name="afooter" id="afooter"></a>
<a name="afooter" id="afooter" class="anchor">rodapé</a>

<div id="doormat">
Menu do rodape
Expand Down
3 changes: 3 additions & 0 deletions src/brasil/gov/temas/themes/azul/rules.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@
<replace css:theme="#voltar-topo" css:content="#voltar-topo" />
<replace css:theme="#extra-footer" css:content="#extra-footer" />
<replace css:theme="#accessibility" css:content="#accessibility" />
<replace css:theme="#acontent" css:content="#acontent" css:if-content="#acontent"/>
<replace css:theme="#anavigation" css:content="#anavigation" css:if-content="#anavigation"/>
<replace css:theme="#afooter" css:content="#afooter" css:if-content="#afooter"/>
<drop css:content="#viewlet-below-content-body" />
<replace css:theme="#barra_brasil_js" css:content-children="#barra_brasil_js" />

Expand Down
7 changes: 7 additions & 0 deletions src/brasil/gov/temas/themes/branco/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ div#wrapper-barra-brasil {
padding: 0 3px;
}

.anchor {
display: block;
font-size: 0;
height: 0;
width: 0;
}

/* Titulo do portal
========================================================================== */

Expand Down
6 changes: 3 additions & 3 deletions src/brasil/gov/temas/themes/branco/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@

<!-- Column 1 -->
<div id="navigation">
<a name="anavigation" id="anavigation"></a>
<a name="anavigation" id="anavigation" class="anchor">menu</a>
<span class="menuTrigger">Menu</span>
<div id="portal-column-one" class="cell width-1:4 position-0">

Expand Down Expand Up @@ -301,7 +301,7 @@

<!-- Conteudo -->
<div id="portal-column-content" class="cell width-1:2 position-1:4">
<a name="acontent" id="acontent"></a>
<a name="acontent" id="acontent" class="anchor">conteúdo</a>

<div id="main-content" class="">

Expand Down Expand Up @@ -422,7 +422,7 @@ <h3>Content subheading H3</h3>

<!-- Footer -->
<div id="footer" role="contentinfo">
<a name="afooter" id="afooter"></a>
<a name="afooter" id="afooter" class="anchor">rodapé</a>

<div id="doormat">
Menu do rodape
Expand Down
3 changes: 3 additions & 0 deletions src/brasil/gov/temas/themes/branco/rules.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@
<replace css:theme="#voltar-topo" css:content="#voltar-topo" />
<replace css:theme="#extra-footer" css:content="#extra-footer" />
<replace css:theme="#accessibility" css:content="#accessibility" />
<replace css:theme="#acontent" css:content="#acontent" css:if-content="#acontent"/>
<replace css:theme="#anavigation" css:content="#anavigation" css:if-content="#anavigation"/>
<replace css:theme="#afooter" css:content="#afooter" css:if-content="#afooter"/>
<drop css:content="#viewlet-below-content-body" />
<replace css:theme="#barra_brasil_js" css:content-children="#barra_brasil_js" />

Expand Down
7 changes: 7 additions & 0 deletions src/brasil/gov/temas/themes/verde/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ div#wrapper-barra-brasil {
color: #006600;
}

.anchor {
display: block;
font-size: 0;
height: 0;
width: 0;
}

/* Titulo do portal
========================================================================== */

Expand Down
6 changes: 3 additions & 3 deletions src/brasil/gov/temas/themes/verde/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@

<!-- Column 1 -->
<div id="navigation">
<a name="anavigation" id="anavigation"></a>
<a name="anavigation" id="anavigation" class="anchor">menu</a>
<span class="menuTrigger">Menu</span>
<div id="portal-column-one" class="cell width-1:4 position-0">

Expand Down Expand Up @@ -301,7 +301,7 @@

<!-- Conteudo -->
<div id="portal-column-content" class="cell width-1:2 position-1:4">
<a name="acontent" id="acontent"></a>
<a name="acontent" id="acontent" class="anchor">conteúdo</a>

<div id="main-content" class="">

Expand Down Expand Up @@ -422,7 +422,7 @@ <h3>Content subheading H3</h3>

<!-- Footer -->
<div id="footer" role="contentinfo">
<a name="afooter" id="afooter"></a>
<a name="afooter" id="afooter" class="anchor">rodapé</a>

<div id="doormat">
Menu do rodape
Expand Down
3 changes: 3 additions & 0 deletions src/brasil/gov/temas/themes/verde/rules.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@
<replace css:theme="#voltar-topo" css:content="#voltar-topo" />
<replace css:theme="#extra-footer" css:content="#extra-footer" />
<replace css:theme="#accessibility" css:content="#accessibility" />
<replace css:theme="#acontent" css:content="#acontent" css:if-content="#acontent"/>
<replace css:theme="#anavigation" css:content="#anavigation" css:if-content="#anavigation"/>
<replace css:theme="#afooter" css:content="#afooter" css:if-content="#afooter"/>
<drop css:content="#viewlet-below-content-body" />
<replace css:theme="#barra_brasil_js" css:content-children="#barra_brasil_js" />

Expand Down