npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-next-focus

v0.0.12

Published

add enter key jump function to your form automatically

Downloads

214,441

Readme

Automatically add enter key jump responses to your input

Support input textarea and other third-party library input

Import

import { createApp } from 'vue'
import App from './App.vue'
import { vue_next_focus } from "vue-next-focus";

const app = createApp( App )

app.use( vue_next_focus )
app.mount( '#app' )

Usage

All but the last input automatically has the enter key to jump to the next input

<div v-next-focus>
        <input type="text" />
        <input type="text" />
        <input type="text" />
        <input type="text" />
        <input type="text" />
</div>

support for element-plus, other framing theories also support it

 <div v-next-focus>
        <el-input type="text" />
        <el-input type="text" />
        <el-input type="text" />
        <el-input type="text" />
        <el-input type="text" />
</div>

This is also valid for a single input

<input type="text" v-next-focus/>
<input type="text" />

Temporary skip support

<div v-next-focus>
        <input type="text" />
        <input type="text" focus-skip/> <!-- This element will be skipped -->
        <input type="text" />
        <input type="text" />
        <input type="text" />
</div>

Exact jump

<div v-next-focus>
        <input type="text" />
        <input type="text" focus-jump="aaa"/> <!-- Will jump to the last input -->
        <input type="text" />
        <input type="text" />
        <input type="text" focus-id="aaa"/>
</div>
<input type="text" />
<input type="text" v-next-focus="'aaa'"/> <!-- Will jump to the last input -->
<input type="text" />
<input type="text" />
<input type="text" focus-id="aaa"/>

textarea

In order not to affect the enter response of a textarea, the library will handle the textarea when it encounters a textarea. You need to hold down ctrl and then trigger enter. Of course, we've added hints for each Textarea's placeholder property.

Component library

There might be some problems in specific third-party component libraries, but these are usually not problems with vue-next-focus. There are two common problems:

  • Third-party components use non-element root nodes, and due to the limitations of the Vue framework itself, the directives cannot take effect. This is a limit of Vue itself. Of course, you can also think that the third-party components have not taken into account. I personally clearly recognize this as a design flaw in Vue. I can almost know how the Vue team made a foolish adherence to the so-called design principles, even though the foolish adherence can lead to inconvenience and loss of flexibility. In this case, a clear warning will be printed on the console.
  • If focus-skip fails or properties like focus-id fail, it is very likely that some attributes on the components have been automatically deleted by the third-party component. This is purely a problem with the component library.

The solutions to the above problems are as follows:

  • For components that do not support directives, you can wrap the components with div, and then write the directives on the div, or write the directives on the common parent element.
  • For the problem that focus-skip fails, you can only use div to wrap the component and then write the property on the div.