Giter Club home page Giter Club logo

svelte-number-spinner's People

Contributors

bohnacker avatar matths avatar mustafa0x avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

svelte-number-spinner's Issues

editBlurHandler() causes the screen to snap to the element

Hey there, I'm using NumberSpinner in a modal with a bunch of other spinners. When I click anywhere that isn't the NumberSpinner, the modal snaps to every NumberSpinner element. When I remove stopEditing() from this line:

async function editBlurHandler(ev) {
    dispatch("consoleLog", ev.type);

    stopEditing();
  }

The problem is solved, and I see this block here contains the real problem:

// Bring focus back to the drag element if the body was clicked:
    setTimeout(() => {
      if (document.activeElement === document.body || document.activeElement === editElement) {
        dragElement.focus();
      }
    }, 0);

The problem is document.activeElement === document.body || . Since I've loaded in a modal (and you know there are 100 different techniques to load a modal) it seems the body is currently "focused." Are you sure you need this conditional? The component seems to work fine when I remove it.

Allow Edit On Single Click

We had this at one point but then in a release:

With this version a number spinner has to be focussed with a first click and enter edit mode with the second click.

I know some work has been done since then and I'm wondering if it's possible to get this functionality back as an option. editOnSingleClick. In my case, a user raised a good point that they expected the box to be a traditional number spinner with the "added ability" to drag with the mouse.

Runs in dev, but fails to build

So I just installed this to an existing project which builds without issue, until I install the spinner:

[!] (plugin terser) Error: Unexpected token: operator (?)
SyntaxError: Unexpected token: operator (?)
at Z.get (...\node_modules\terser\dist\bundle.min.js:1:463)
at reportError (...\node_modules\jest-worker\build\workers\processChild.js:107:11)
at reportClientError (...\node_modules\jest-worker\build\workers\processChild.js:87:10)
at execFunction (...\node_modules\jest-worker\build\workers\processChild.js:157:5)
at execHelper (...\node_modules\jest-worker\build\workers\processChild.js:139:5)
at execMethod (...\node_modules\jest-worker\build\workers\processChild.js:143:5)
at process. (...\node_modules\jest-worker\build\workers\processChild.js:64:7)
at process.emit (events.js:315:20)
at emit (internal/child_process.js:876:12)
at processTicksAndRejections (internal/process/task_queues.js:85:21)

I've uninstalled and rebuilt and the app builds fine again, then after installing the spinner it again fails to build.

Love the component, any idea why it's failing to build?

Enter key is disabled whenever NumberInput is present.

Given:

<svelte:window
  on:keydown={keydownHandler}
/>

It runs this:

    // prevent submitting if the number spinner is inside a form element
    if (ev.key == "Enter") {
      ev.preventDefault();
    }

Which unfortunately causes the user to be unable to hit enter anywhere else on the page. In my case it's in an RTE, and I can confirm that commenting this this conditional out fixes the problem. ๐Ÿ‘

I wonder if it could be made more specific to the element itself somehow, or if there just needs to be a flag property added on NumberSpinner.

Thanks again for this amazing lib! It's been very well received by my users.

How can I handle keypress events?

We have onChange and input, but no keypress: my use case is that I want to perform an action when the user presses the Enter key.

editOnClick doesn't work on mobile

Hello, excellent work on this component! I know you have specifically said this is a mouse or keyboard component, but I figured I'd make the issue and see if you had any thoughts (or hacks) on how to get it to work.

Device: Android, Samsung S10 Edge
Browser: Chrome or Firefox

The editOnClick option simply does not activate on mobile. No amount of clicking or double-clicking, even with editOnClick false or true, will result in the box being editable.

Otherwise everything works as expected!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.