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

@solid-aria/focus

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solid-aria/focus - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

16

dist/cjs/index.js

@@ -34,3 +34,3 @@ 'use strict';

function createFocusable(props$1, ref) {
const [autoFocus, setAutoFocus] = solidJs.createSignal(!!utils.access(props$1.autoFocus));
const [autofocus, setAutofocus] = solidJs.createSignal(!!utils.access(props$1.autofocus));
const {

@@ -52,4 +52,4 @@ focusProps

autoFocus() && ((_access = utils.access(ref)) === null || _access === void 0 ? void 0 : _access.focus());
setAutoFocus(false);
autofocus() && ((_access = utils.access(ref)) === null || _access === void 0 ? void 0 : _access.focus());
setAutofocus(false);
});

@@ -85,3 +85,3 @@ return {

const [isFocused, setFocused] = solidJs.createSignal(false);
const [isFocusVisibleState, setFocusVisibleState] = solidJs.createSignal(utils.access(props.autoFocus) || interactions.isKeyboardFocusVisible());
const [isFocusVisibleState, setFocusVisibleState] = solidJs.createSignal(utils.access(props.autofocus) || interactions.isKeyboardFocusVisible());

@@ -259,4 +259,4 @@ const isFocusVisible = () => isFocused() && isFocusVisibleState();

createRestoreFocus(ctx.scopeRef, () => !!props.restoreFocus, () => !!props.contain);
const autoFocusReaction = solidJs.createReaction(() => {
if (!props.autoFocus) {
const autofocusReaction = solidJs.createReaction(() => {
if (!props.autofocus) {
return;

@@ -276,3 +276,3 @@ }

autoFocusReaction(ctx.scopeRef);
autofocusReaction(ctx.scopeRef);
return [(() => {

@@ -609,3 +609,3 @@ const _el$ = _tmpl$.cloneNode(true);

function createRestoreFocus(scopeRef, restoreFocus, contain) {
// create a memo to save the active element before a child with autoFocus=true mounts.
// create a memo to save the active element before a child with autofocus=true mounts.
const nodeToRestoreMemo = solidJs.createMemo(() => {

@@ -612,0 +612,0 @@ return typeof document !== "undefined" ? document.activeElement : null;

@@ -30,3 +30,3 @@ import { createFocus, createKeyboard, isKeyboardFocusVisible, createFocusVisibleListener, createFocusWithin, getInteractionModality } from '@solid-aria/interactions';

function createFocusable(props, ref) {
const [autoFocus, setAutoFocus] = createSignal(!!access(props.autoFocus));
const [autofocus, setAutofocus] = createSignal(!!access(props.autofocus));
const {

@@ -48,4 +48,4 @@ focusProps

autoFocus() && ((_access = access(ref)) === null || _access === void 0 ? void 0 : _access.focus());
setAutoFocus(false);
autofocus() && ((_access = access(ref)) === null || _access === void 0 ? void 0 : _access.focus());
setAutofocus(false);
});

@@ -81,3 +81,3 @@ return {

const [isFocused, setFocused] = createSignal(false);
const [isFocusVisibleState, setFocusVisibleState] = createSignal(access(props.autoFocus) || isKeyboardFocusVisible());
const [isFocusVisibleState, setFocusVisibleState] = createSignal(access(props.autofocus) || isKeyboardFocusVisible());

@@ -255,4 +255,4 @@ const isFocusVisible = () => isFocused() && isFocusVisibleState();

createRestoreFocus(ctx.scopeRef, () => !!props.restoreFocus, () => !!props.contain);
const autoFocusReaction = createReaction(() => {
if (!props.autoFocus) {
const autofocusReaction = createReaction(() => {
if (!props.autofocus) {
return;

@@ -272,3 +272,3 @@ }

autoFocusReaction(ctx.scopeRef);
autofocusReaction(ctx.scopeRef);
return [(() => {

@@ -605,3 +605,3 @@ const _el$ = _tmpl$.cloneNode(true);

function createRestoreFocus(scopeRef, restoreFocus, contain) {
// create a memo to save the active element before a child with autoFocus=true mounts.
// create a memo to save the active element before a child with autofocus=true mounts.
const nodeToRestoreMemo = createMemo(() => {

@@ -608,0 +608,0 @@ return typeof document !== "undefined" ? document.activeElement : null;

@@ -26,3 +26,3 @@ /*

export function createFocusable(props, ref) {
const [autoFocus, setAutoFocus] = createSignal(!!access(props.autoFocus));
const [autofocus, setAutofocus] = createSignal(!!access(props.autofocus));
const { focusProps } = createFocus(props);

@@ -37,6 +37,6 @@ const { keyboardProps } = createKeyboard(props);

onMount(() => {
autoFocus() && access(ref)?.focus();
setAutoFocus(false);
autofocus() && access(ref)?.focus();
setAutofocus(false);
});
return { focusableProps };
}

@@ -27,3 +27,3 @@ /*

const [isFocused, setFocused] = createSignal(false);
const [isFocusVisibleState, setFocusVisibleState] = createSignal(access(props.autoFocus) || isKeyboardFocusVisible());
const [isFocusVisibleState, setFocusVisibleState] = createSignal(access(props.autofocus) || isKeyboardFocusVisible());
const isFocusVisible = () => isFocused() && isFocusVisibleState();

@@ -30,0 +30,0 @@ createFocusVisibleListener(setFocusVisibleState, () => null, // hack for passing a dep that never changes

@@ -60,4 +60,4 @@ /*

createRestoreFocus(ctx.scopeRef, () => !!props.restoreFocus, () => !!props.contain);
const autoFocusReaction = createReaction(() => {
if (!props.autoFocus) {
const autofocusReaction = createReaction(() => {
if (!props.autofocus) {
return;

@@ -76,3 +76,3 @@ }

// This ensure scopeRef is not empty when trying to focus an element in the `FocusScope`.
autoFocusReaction(ctx.scopeRef);
autofocusReaction(ctx.scopeRef);
return (<>

@@ -340,3 +340,3 @@ <span data-focus-scope-start hidden ref={startRef}/>

function createRestoreFocus(scopeRef, restoreFocus, contain) {
// create a memo to save the active element before a child with autoFocus=true mounts.
// create a memo to save the active element before a child with autofocus=true mounts.
const nodeToRestoreMemo = createMemo(() => {

@@ -343,0 +343,0 @@ return typeof document !== "undefined" ? document.activeElement : null;

@@ -12,3 +12,3 @@ import { CreateFocusProps, CreateKeyboardProps } from "@solid-aria/interactions";

*/
autoFocus?: MaybeAccessor<boolean | undefined>;
autofocus?: MaybeAccessor<boolean | undefined>;
/**

@@ -15,0 +15,0 @@ * Whether to exclude the element from the sequential tab order. If true,

@@ -19,3 +19,3 @@ import { FocusResult, FocusWithinResult } from "@solid-aria/interactions";

*/
autoFocus?: MaybeAccessor<boolean | undefined>;
autofocus?: MaybeAccessor<boolean | undefined>;
}

@@ -22,0 +22,0 @@ declare type FocusRingProps = FocusResult["focusProps"] | FocusWithinResult["focusWithinProps"];

@@ -20,3 +20,3 @@ import { JSX } from "solid-js";

*/
autoFocus?: boolean;
autofocus?: boolean;
}

@@ -23,0 +23,0 @@ interface FocusManagerOptions {

{
"name": "@solid-aria/focus",
"version": "0.1.2",
"version": "0.1.3",
"private": false,

@@ -43,8 +43,11 @@ "description": "Primitives for dealing with focus rings and focus management.",

"dependencies": {
"@solid-aria/interactions": "^0.1.2",
"@solid-aria/types": "^0.1.2",
"@solid-aria/utils": "^0.1.2",
"@solid-aria/interactions": "^0.1.3",
"@solid-aria/types": "^0.1.3",
"@solid-aria/utils": "^0.1.3",
"@solid-primitives/props": "^2.1.7",
"@solid-primitives/utils": "^2.1.0"
},
"devDependencies": {
"solid-js": "^1.4.4"
},
"peerDependencies": {

@@ -51,0 +54,0 @@ "solid-js": "^1.4.4"

@@ -54,3 +54,3 @@ <p>

<>
<TextField autoFocus />
<TextField autofocus />
<TextField excludeFromTabOrder />

@@ -120,3 +120,3 @@ </>

<Show when={isOpen()}>
<FocusScope contain restoreFocus autoFocus>
<FocusScope contain restoreFocus autofocus>
<label for="first-input">First Input</label>

@@ -123,0 +123,0 @@ <input id="first-input" />

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