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

@mirohq/design-system-use-press

Package Overview
Dependencies
Maintainers
2
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mirohq/design-system-use-press - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

31

dist/main.js

@@ -189,2 +189,3 @@ 'use strict';

if (state.target instanceof HTMLElement && state.target.contains(target) && (isHTMLAnchorLink(state.target) || state.target.getAttribute("role") === "link")) {
state.ignoreClickAfterPress = true;
state.target.click();

@@ -264,7 +265,27 @@ }

const role = element.getAttribute("role");
return isEnterOrSpaceEvent(event) && // Inputs
!(element instanceof HTMLInputElement && !isValidInputKey(element, key) || element instanceof HTMLTextAreaElement || element.isContentEditable) && // A link with a valid href should be handled natively,
// unless it also has role='button' and was triggered using Space.
(!isHTMLAnchorLink(element) || role === "button" && key !== "Enter") && // An element with role='link' should only trigger with Enter key
!(role === "link" && key !== "Enter");
if (!isEnterOrSpaceEvent(event)) {
return false;
}
const isLink = isHTMLAnchorLink(element) || role === "link";
if (isLink && key === "Enter") {
return true;
}
if (element.tagName === "A") {
if (role === "button" && key === " ") {
return true;
}
return false;
}
const isButton = role === "button" || element.tagName === "BUTTON";
if (isButton) {
return true;
}
const isInput = element instanceof HTMLInputElement;
if (isInput && isValidInputKey(element, key) && key === " ") {
return true;
}
if (!isLink && !isButton && !isInput) {
return true;
}
return false;
};

@@ -271,0 +292,0 @@

@@ -185,2 +185,3 @@ import { useRef, useState, useEffect } from 'react';

if (state.target instanceof HTMLElement && state.target.contains(target) && (isHTMLAnchorLink(state.target) || state.target.getAttribute("role") === "link")) {
state.ignoreClickAfterPress = true;
state.target.click();

@@ -260,7 +261,27 @@ }

const role = element.getAttribute("role");
return isEnterOrSpaceEvent(event) && // Inputs
!(element instanceof HTMLInputElement && !isValidInputKey(element, key) || element instanceof HTMLTextAreaElement || element.isContentEditable) && // A link with a valid href should be handled natively,
// unless it also has role='button' and was triggered using Space.
(!isHTMLAnchorLink(element) || role === "button" && key !== "Enter") && // An element with role='link' should only trigger with Enter key
!(role === "link" && key !== "Enter");
if (!isEnterOrSpaceEvent(event)) {
return false;
}
const isLink = isHTMLAnchorLink(element) || role === "link";
if (isLink && key === "Enter") {
return true;
}
if (element.tagName === "A") {
if (role === "button" && key === " ") {
return true;
}
return false;
}
const isButton = role === "button" || element.tagName === "BUTTON";
if (isButton) {
return true;
}
const isInput = element instanceof HTMLInputElement;
if (isInput && isValidInputKey(element, key) && key === " ") {
return true;
}
if (!isLink && !isButton && !isInput) {
return true;
}
return false;
};

@@ -267,0 +288,0 @@

2

package.json
{
"name": "@mirohq/design-system-use-press",
"version": "0.1.3",
"version": "0.1.4",
"description": "",

@@ -5,0 +5,0 @@ "author": "Miro",

Sorry, the diff of this file is not supported yet

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