Skip to content

Commit e3f6046

Browse files
authored
fix(Offcanvas): change .modal-backdrop to .offcanvas-backdrop (react-bootstrap#5984)
* fix: changed .modal-backdrop to .offcanvas-backdrop * Removed modalBsPrefix in Offcanvas
1 parent 74894de commit e3f6046

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/Offcanvas.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ const Offcanvas: BsPrefixRefForwardingComponent<'div', OffcanvasProps> =
221221
const handleHide = useEventCallback(onHide);
222222

223223
bsPrefix = useBootstrapPrefix(bsPrefix, 'offcanvas');
224-
const modalBsPrefix = useBootstrapPrefix(undefined, 'modal');
225224

226225
const modalContext = useMemo(
227226
() => ({
@@ -260,12 +259,12 @@ const Offcanvas: BsPrefixRefForwardingComponent<'div', OffcanvasProps> =
260259
<div
261260
{...backdropProps}
262261
className={classNames(
263-
`${modalBsPrefix}-backdrop`,
262+
`${bsPrefix}-backdrop`,
264263
backdropClassName,
265264
)}
266265
/>
267266
),
268-
[backdropClassName, modalBsPrefix],
267+
[backdropClassName, bsPrefix],
269268
);
270269

271270
const renderDialog = (dialogProps) => (

test/OffcanvasSpec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ describe('<Offcanvas>', () => {
6565
<Offcanvas show backdropClassName="custom-backdrop" onHide={noOp}>
6666
<strong>Message</strong>
6767
</Offcanvas>,
68-
).find('.modal-backdrop.custom-backdrop');
68+
).find('.offcanvas-backdrop.custom-backdrop');
6969
});
7070

7171
it('Should pass style to the offcanvas', () => {
@@ -114,7 +114,7 @@ describe('<Offcanvas>', () => {
114114
<strong>Message</strong>
115115
</Offcanvas>,
116116
)
117-
.find('div.modal-backdrop')
117+
.find('div.offcanvas-backdrop')
118118
.simulate('click');
119119

120120
expect(onHideSpy).to.have.been.called;

0 commit comments

Comments
 (0)