Skip to content

Commit

Permalink
Remove the feedback header click close behavior and instead add a clo…
Browse files Browse the repository at this point in the history
…se button.

This is a possible fix to issue #2362 that might be better than the
attempt in openwebwork#1036.

This adds a close button to feedback popover headers.  The previous
behavior of clicking on the header to close it has been removed in favor
of this close button.
  • Loading branch information
drgrice1 committed Apr 10, 2024
1 parent 97fa82a commit aedc80c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion htdocs/js/Feedback/feedback.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

// Make a click on the popover header close the popover.
feedbackPopover.tip
?.querySelector('.popover-header')
?.querySelector('.popover-header .btn-close')
?.addEventListener('click', () => feedbackPopover.hide());

if (feedbackPopover.tip) feedbackPopover.tip.dataset.iframeHeight = '1';
Expand Down
6 changes: 6 additions & 0 deletions htdocs/js/Problem/problem.scss
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,12 @@
cursor: pointer;
--bs-popover-header-bg: var(--bs-info);
--bs-popover-header-color: white;

.btn-close {
--bs-btn-close-opacity: 0.75;
--bs-btn-close-hover-opacity: 1;
--bs-btn-close-focus-shadow: 0 0 0 0.15rem #00000080;
}
}

&.correct {
Expand Down
16 changes: 15 additions & 1 deletion macros/PG.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1197,7 +1197,21 @@ sub ENDDOCUMENT {
: $options{resultTitle}
),
data => {
bs_title => $options{resultTitle},
bs_title => Mojo::DOM->new_tag(
'div',
class => 'd-flex align-items-center justify-content-between',
'data-bs-theme' => 'dark',
sub {
Mojo::DOM->new_tag('span', style => 'width:20.4px')
. Mojo::DOM->new_tag('span', class => 'mx-3', $options{resultTitle})
. Mojo::DOM->new_tag(
'button',
type => 'button',
class => 'btn-close',
'aria-label' => maketext('Close')
);
}
)->to_string,
bs_toggle => 'popover',
bs_trigger => 'click',
bs_placement => 'bottom',
Expand Down

0 comments on commit aedc80c

Please sign in to comment.