fmaclen / svelte-currency-input

A masked form input that converts numbers to localized currency formats as you type
https://svelte-currency-input.fernando.is
MIT License
33 stars 5 forks source link

Change virtual keyboard behavior on Mobile (iOS) #69

Closed pxd5295 closed 10 months ago

pxd5295 commented 10 months ago

Description

Currently on mobile when you select the currency input box you are presented with the standard "tel" virtual keyboard [1-9]. This makes it impossible to use decimal points to specify cent values. If we allowed for an option to set the underlying formatted input's "inputmode" (https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode) we could allow devs to select between "decimal" and "numeric" keyboards on mobile.

Version Used

0.11.1

fmaclen commented 10 months ago

@pxd5295 Oh yeah, I didn't notice this before!

I just put out a PR with a fix that dynamically sets the inputmode to decimal or numeric based on the fractionDigits prop, that way you don't have to set the prop manually.

Would you mind checking it out before I publish the change? https://e3da29bc.svelte-currency-input.pages.dev/

All of the fields in the demo page should allow decimals, except for the last one with the placeholder How many Dinars? which does not.

pxd5295 commented 10 months ago

@fmaclen Works perfect for me on iOS 16.6

Thanks for the quick help

github-actions[bot] commented 10 months ago

:tada: This issue has been resolved in version 0.11.3 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

fmaclen commented 10 months ago

@pxd5295 thanks for checking it out.