Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

solid-dismiss

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

solid-dismiss - npm Package Compare versions

Comparing version 1.6.6 to 1.6.7

3

dist/source/index.jsx

@@ -23,3 +23,3 @@ import { isServer } from "solid-js/web";

const modal = props.modal || false;
const { id, menuButton, menuPopup, focusElementOnClose, focusElementOnOpen = modal ? "menuPopup" : undefined, cursorKeys = false, closeWhenMenuButtonIsTabbed = false, closeWhenMenuButtonIsClicked = true, closeWhenScrolling = false, closeWhenDocumentBlurs = false, closeWhenOverlayClicked = true, closeWhenEscapeKeyIsPressed = true, overlay = modal, overlayElement = modal, trapFocus = modal, removeScrollbar = modal, enableLastFocusSentinel = false, mount = modal ? "body" : undefined,
const { id, menuButton, menuPopup, focusElementOnClose, focusElementOnOpen = modal ? "menuPopup" : undefined, focusMenuButtonOnMouseDown = true, cursorKeys = false, closeWhenMenuButtonIsTabbed = false, closeWhenMenuButtonIsClicked = true, closeWhenScrolling = false, closeWhenDocumentBlurs = false, closeWhenOverlayClicked = true, closeWhenEscapeKeyIsPressed = true, overlay = modal, overlayElement = modal, trapFocus = modal, removeScrollbar = modal, enableLastFocusSentinel = false, mount = modal ? "body" : undefined,
// stopComponentEventPropagation = false,

@@ -39,2 +39,3 @@ show = false, onToggleScrollbar, onOpen, deadMenuButton, ignoreMenuPopupWhenTabbing, mountedPopupsSafeList, } = props;

focusElementOnClose,
focusMenuButtonOnMouseDown,
deadMenuButton,

@@ -41,0 +42,0 @@ focusElementOnOpen,

@@ -85,9 +85,13 @@ import { dismissStack } from "../global/dismissStack";

export const onMouseDownMenuButton = (state, e) => {
const { focusMenuButtonOnMouseDown } = state;
const menuBtnEl = e.currentTarget;
state.menuBtnMouseDownFired = true;
menuBtnEl.addEventListener("click", state.onClickMenuButtonRef);
menuBtnEl.addEventListener("blur", state.onBlurMenuButtonRef);
requestAnimationFrame(() => {
menuBtnEl.focus();
});
// if `false`, enables switching focus from menuButton to menuPopup input element while keeping virtual keyboard opened in iOS. However end-user must also provide additional logic to fire inside menuButton onclick for behavior to work.
if (focusMenuButtonOnMouseDown) {
menuBtnEl.addEventListener("blur", state.onBlurMenuButtonRef);
requestAnimationFrame(() => {
menuBtnEl.focus();
});
}
};

@@ -94,0 +98,0 @@ // TODO: ?

@@ -11,2 +11,4 @@ import { getMenuButton } from "../local/menuButton";

if (type === "focusElementOnOpen") {
if (inputElement === "none")
return null;
if (inputElement === "firstChild") {

@@ -13,0 +15,0 @@ return getNextTabbableElement({

@@ -71,7 +71,7 @@ import { Accessor, JSX, ParentComponent } from "solid-js";

*
* *CSS string queried from menuPopup element, or if string value is `"menuPopup"` uses menuPopup element, or if string value is `"firstChild"` uses first tabbable element inside menuPopup.
* *CSS string queried from menuPopup element. If string value is `"menuPopup"` uses menuPopup element. `"firstChild"` uses first tabbable element inside menuPopup. `"none"` focus remains on `"menuButton"`, even if `Dismiss.modal` is true.
*
* @defaultValue focus remains on `"menuButton"`. But if there's no menu button, focus remains on document's activeElement.
*/
focusElementOnOpen?: "menuPopup" | "firstChild" | JSX.Element | (() => JSX.Element);
focusElementOnOpen?: "menuPopup" | "firstChild" | "none" | JSX.Element | (() => JSX.Element);
/**

@@ -138,2 +138,8 @@ *

/**
* @default `true`
*
* Set to `false` if you want to switch focus from menuButton to menuPopup input element while keeping virtual keyboard opened in iOS. However end-user must also provide additional logic to fire inside menuButton onclick for behavior to work.
*/
focusMenuButtonOnMouseDown?: boolean;
/**
* When `true`, clicking or focusing on menuButton doesn't toggle menuPopup. However the menuButton is still used as reference from `focusElementOnClose`

@@ -140,0 +146,0 @@ *

{
"name": "solid-dismiss",
"version": "1.6.6",
"version": "1.6.7",
"homepage": "https://aquaductape.github.io/solid-dismiss/",

@@ -5,0 +5,0 @@ "description": "Handles \"click outside\" behavior for popup menu. Closing is triggered by click/focus outside of popup element or pressing \"Escape\" key.",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc