New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@guidepup/virtual-screen-reader

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@guidepup/virtual-screen-reader - npm Package Compare versions

Comparing version 0.4.0 to 0.5.0

2

lib/getNodeAccessibilityData/getAccessibleValue.d.ts

@@ -1,1 +0,1 @@

export declare function getAccessibleValue(node: Node): string;
export declare function getAccessibleValue(node: Node): any;

@@ -5,5 +5,32 @@ "use strict";

const isElement_1 = require("../isElement");
function getSelectValue(node) {
const selectedOptions = [...node.options].filter((option) => option.selected);
if (node.multiple) {
return [...selectedOptions].map((opt) => opt.value).join("; ");
}
if (selectedOptions.length === 0) {
return "";
}
return selectedOptions[0].value;
}
function getInputValue(node) {
if (["checkbox", "radio"].includes(node.type)) {
return "";
}
return node.value;
}
function getAccessibleValue(node) {
return (0, isElement_1.isElement)(node) ? node.getAttribute("value") ?? "" : "";
if (!(0, isElement_1.isElement)(node)) {
return "";
}
switch (node.localName) {
case "input": {
return getInputValue(node);
}
case "select": {
return getSelectValue(node);
}
}
return "";
}
exports.getAccessibleValue = getAccessibleValue;

@@ -8,3 +8,3 @@ export declare function getNodeAccessibilityData({ inheritedImplicitPresentational, node, }: {

accessibleName: string;
accessibleValue: string;
accessibleValue: any;
childrenPresentational: boolean;

@@ -11,0 +11,0 @@ role: string;

@@ -134,2 +134,13 @@ "use strict";

}
async #refreshState() {
await tick();
this.#invalidateTreeCache();
const tree = this.#getAccessibilityTree();
if (!tree.length) {
return;
}
const currentIndex = this.#getCurrentIndexByNode(tree);
const newActiveNode = tree.at(currentIndex);
this.#updateState(newActiveNode);
}
#getCurrentIndex(tree) {

@@ -143,2 +154,5 @@ return tree.findIndex(({ accessibleDescription, accessibleName, accessibleValue, node, role, spokenRole, }) => accessibleDescription === this.#activeNode?.accessibleDescription &&

}
#getCurrentIndexByNode(tree) {
return tree.findIndex(({ node }) => node === this.#activeNode?.node);
}
/**

@@ -303,2 +317,3 @@ * Detect whether the screen reader is supported for the current OS.

await user_event_1.default.keyboard(keyboardCommand, defaultUserEventOptions);
await this.#refreshState();
return;

@@ -326,2 +341,3 @@ }

await user_event_1.default.type(target, text, defaultUserEventOptions);
await this.#refreshState();
return;

@@ -328,0 +344,0 @@ }

{
"name": "@guidepup/virtual-screen-reader",
"version": "0.4.0",
"version": "0.5.0",
"description": "Virtual screen reader driver for unit test automation.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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