Skip to content

Commit

Permalink
MDL-78619 theme: Communication button fixes
Browse files Browse the repository at this point in the history
The footer button was missing some CSS to factor in the blocks drawer.
Also added noreferrer to the window.open call made when clicking the
communication button, to avoid the risks associated with opening in
_blank without removing access to the referrer and opener (noopener is
implicitly defined in modern browsers when noreferrer is set).
  • Loading branch information
mickhawkins committed Aug 27, 2023
1 parent a3fa3e3 commit d0fe8d4
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
3 changes: 2 additions & 1 deletion theme/boost/scss/moodle/drawer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ $drawer-bg: darken($body-bg, 5%) !default;
[data-region="drawer"] {
padding: $drawer-padding-x $drawer-padding-y;
}
.jsenabled .btn-footer-popover {
.jsenabled .btn-footer-popover,
.jsenabled .btn-footer-communication {
@include transition(0.2s);
}
}
Expand Down
3 changes: 2 additions & 1 deletion theme/boost/scss/moodle/layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@
margin-left: 0;
margin-right: $drawer-right-width;
padding-right: 1rem;
.jsenabled & .btn-footer-popover {
.jsenabled & .btn-footer-popover,
.jsenabled & .btn-footer-communication {
right: calc(#{$drawer-right-width} + 2rem);
}
}
Expand Down
8 changes: 5 additions & 3 deletions theme/boost/style/moodle.css
Original file line number Diff line number Diff line change
Expand Up @@ -29610,12 +29610,14 @@ span.editinstructions .alert-link {
[data-region=drawer] {
padding: 20px 20px;
}
.jsenabled .btn-footer-popover {
.jsenabled .btn-footer-popover,
.jsenabled .btn-footer-communication {
transition: 0.2s;
}
}
@media (min-width: 576px) and (prefers-reduced-motion: reduce) {
.jsenabled .btn-footer-popover {
.jsenabled .btn-footer-popover,
.jsenabled .btn-footer-communication {
transition: none;
}
}
Expand Down Expand Up @@ -36666,7 +36668,7 @@ span[data-flexitour=container][x-placement=right] div[data-role=arrow]:after, sp
margin-right: 315px;
padding-right: 1rem;
}
.jsenabled #page.drawers.show-drawer-right .btn-footer-popover {
.jsenabled #page.drawers.show-drawer-right .btn-footer-popover, .jsenabled #page.drawers.show-drawer-right .btn-footer-communication {
right: calc(315px + 2rem);
}
}
Expand Down
2 changes: 1 addition & 1 deletion theme/boost/templates/footer.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<footer id="page-footer" class="footer-popover bg-white">
<div data-region="footer-container-popover">
{{#output.has_communication_links}}
<button onclick="window.open('{{output.communication_url}}', '_blank')" class="btn btn-icon bg-primary text-white icon-no-margin btn-footer-communication" aria-label="{{#str}}communicationroomlink, course{{/str}}">
<button onclick="window.open('{{output.communication_url}}', '_blank', 'noreferrer')" class="btn btn-icon bg-primary text-white icon-no-margin btn-footer-communication" aria-label="{{#str}}communicationroomlink, course{{/str}}">
{{#pix}}t/messages-o, core{{/pix}}
</button>
{{/output.has_communication_links}}
Expand Down
8 changes: 5 additions & 3 deletions theme/classic/style/moodle.css
Original file line number Diff line number Diff line change
Expand Up @@ -29610,12 +29610,14 @@ span.editinstructions .alert-link {
[data-region=drawer] {
padding: 20px 20px;
}
.jsenabled .btn-footer-popover {
.jsenabled .btn-footer-popover,
.jsenabled .btn-footer-communication {
transition: 0.2s;
}
}
@media (min-width: 576px) and (prefers-reduced-motion: reduce) {
.jsenabled .btn-footer-popover {
.jsenabled .btn-footer-popover,
.jsenabled .btn-footer-communication {
transition: none;
}
}
Expand Down Expand Up @@ -36600,7 +36602,7 @@ span[data-flexitour=container][x-placement=right] div[data-role=arrow]:after, sp
margin-right: 315px;
padding-right: 1rem;
}
.jsenabled #page.drawers.show-drawer-right .btn-footer-popover {
.jsenabled #page.drawers.show-drawer-right .btn-footer-popover, .jsenabled #page.drawers.show-drawer-right .btn-footer-communication {
right: calc(315px + 2rem);
}
}
Expand Down

0 comments on commit d0fe8d4

Please sign in to comment.