MCPcopy Create free account
hub / github.com/reactstrap/reactstrap / close

Function close

src/Modal.js:410–429  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

408 }
409
410 close() {
411 if (Modal.openCount <= 1) {
412 const modalOpenClassName = mapToCssModules(
413 'modal-open',
414 this.props.cssModule,
415 );
416 // Use regex to prevent matching `modal-open` as part of a different class, e.g. `my-modal-opened`
417 const modalOpenClassNameRegex = new RegExp(
418 `(^| )${modalOpenClassName}( |$)`,
419 );
420 document.body.className = document.body.className
421 .replace(modalOpenClassNameRegex, ' ')
422 .trim();
423 document.body.style.overflow = Modal.originalBodyOverflow;
424 }
425 this.manageFocusAfterClose();
426 Modal.openCount = Math.max(0, Modal.openCount - 1);
427
428 setScrollbarWidth(this._originalBodyPadding);
429 }
430
431 clearBackdropAnimationTimeout() {
432 if (this._backdropAnimationTimeout) {

Callers

nothing calls this directly

Calls 2

mapToCssModulesFunction · 0.90
setScrollbarWidthFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…