Skip to content

Commit 505b197

Browse files
authored
Merge pull request #3657 from projectblacklight/remove-bs4-close
Remove vestiges of bootstrap 4 close
2 parents d2b7cc6 + 825fffd commit 505b197

File tree

5 files changed

+4
-15
lines changed

5 files changed

+4
-15
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="alert alert-dismissible <%= @classes %>">
22
<%= message %>
3-
<%= tag.button button_contents, type: "button", class: "btn-close",
3+
<%= tag.button '', type: "button", class: "btn-close",
44
data: { dismiss: "alert", bs_dismiss: "alert" },
55
aria: { label: "Close" } %>
66
</div>

app/components/blacklight/system/flash_message_component.rb

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,6 @@ def before_render
1616
with_message { @message } if @message
1717
end
1818

19-
# Bootstrap 4 requires the span, but Bootstrap 5 should not have it.
20-
# See https://getbootstrap.com/docs/4.6/components/alerts/#dismissing
21-
# https://getbootstrap.com/docs/5.1/components/alerts/#dismissing
22-
def button_contents
23-
return if helpers.controller.blacklight_config.bootstrap_version == 5
24-
25-
tag.span '&times;'.html_safe, aria: { hidden: true }
26-
end
27-
2819
def alert_class(type)
2920
case type.to_s
3021
when 'success' then "alert-success"

app/components/blacklight/system/modal_component.html.erb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
<h1 class="modal-title"><%= title %></h1>
77
<% end) %>
88

9-
<button type="button" class="blacklight-modal-close btn-close close" data-bl-dismiss="modal" aria-label="<%= t('blacklight.modal.close') %>">
10-
<span aria-hidden="true" class="visually-hidden">&times;</span>
9+
<button type="button" class="blacklight-modal-close btn-close" data-bl-dismiss="modal" aria-label="<%= t('blacklight.modal.close') %>">
1110
</button>
1211
</div>
1312

app/javascript/blacklight-frontend/modal.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ const Modal = (() => {
8181

8282
const contents = `<div class="modal-header">
8383
<div class="modal-title">There was a problem with your request.</div>
84-
<button type="button" class="blacklight-modal-close btn-close close" data-bl-dismiss="modal" aria-label="Close">
85-
<span aria-hidden="true" class="visually-hidden">&times;</span>
84+
<button type="button" class="blacklight-modal-close btn-close" data-bl-dismiss="modal" aria-label="Close">
8685
</button>
8786
</div>
8887
<div class="modal-body">

spec/features/modal_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
expect(page).to have_no_selector 'dialog#blacklight-modal'
77
click_on 'Email'
88
expect(page).to have_css 'dialog#blacklight-modal'
9-
click_on '×'
9+
find('button[aria-label=Close]').click
1010
expect(page).to have_no_selector 'dialog#blacklight-modal'
1111
end
1212
end

0 commit comments

Comments
 (0)