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 invalid role on /leadership modal links (fixes #15538) #15539

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
file, You can obtain one at https://mozilla.org/MPL/2.0/.
#}

<article {% if value.biography %}id="{{ value.id }}"{% endif %} class="vcard{% if value.biography %} has-bio{% endif %}" itemscope itemtype="http://schema.org/Person">
<div {% if value.biography %}id="{{ value.id }}" {% endif %} class="vcard{% if value.biography %} has-bio{% endif %}" itemscope itemtype="http://schema.org/Person">
<figure class="headshot">
{{ srcset_image(value.headshot.image, "width-{200,400}", class="photo", sizes="160px", alt=value.headshot.image_alt_text) }}
<figcaption>
<h4 class="fn" itemprop="name">{{ value.name }}</h4>
<h3 class="fn" itemprop="name">{{ value.name }}</h3>
</figcaption>
</figure>

Expand Down Expand Up @@ -40,4 +40,4 @@ <h4 class="fn" itemprop="name">{{ value.name }}</h4>
{{ value.biography|richtext }}
</div>
{% endif %}
</article>
</div>
4 changes: 2 additions & 2 deletions bedrock/mozorg/templates/mozorg/cms/about/leadership.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ <h2 class="leadership-title{% if first_group.title %} compact{% endif %}">{{ sec
{% for group in section.value.leadership_group %}
<section>
{% if group.title %}
<h3 class="group-title">{{ group.title }}</h3>
<h2 class="group-title">{{ group.title }}</h2>
{% endif %}
<div class="gallery mgmt-corp">
{% for leader in group.leaders %}
Expand All @@ -60,7 +60,7 @@ <h3 class="group-title">{{ group.title }}</h3>
</main>
</div>

<div class="mzp-u-modal-content"></div>
<div id="leadership-modal" class="mzp-u-modal-content"></div>
{% endblock %}

{% block js %}
Expand Down
10 changes: 7 additions & 3 deletions media/js/mozorg/about-leadership.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,26 @@ if (typeof window.Mozilla === 'undefined') {
for (var i = 0; i < bios.length; i++) {
var bio = bios[i];
bio.setAttribute('role', 'button');
bio.setAttribute('aria-controls', 'leadership-modal');
bio.setAttribute('aria-expanded', 'false');
bio.setAttribute('tabindex', '0');

bio.addEventListener('click', function (e) {
e.preventDefault();
var modalContent = this.cloneNode(true);
var openingLink = this;
var modalContent = openingLink.cloneNode(true);
modalContent.removeAttribute('id');
modalContent.setAttribute('role', 'article');
openingLink.setAttribute('aria-expanded', 'true');

MzpModal.createModal(e.target, content, {
MzpModal.createModal(openingLink, content, {
closeText: window.Mozilla.Utils.trans('global-close'),
onCreate: function () {
content.appendChild(modalContent);
modalContent.focus();
},
onDestroy: function () {
modalContent.parentNode.removeChild(modalContent);
openingLink.setAttribute('aria-expanded', 'false');
}
});
});
Expand Down