Comments (4)
Anyways I thought it might be a common use case to have the text auto selected, but whether it needs to be an option or not.. your call.
Nah, I don't think this small functionality deserves its own parameter 😄
Right.. maybe it's still better to explicitly list all those types that actually support the cursor though, in order to avoid possible bugs/errors from occurring (in certain browsers)?
Also nah, it has been like this several years already w/o any issue-reports. Listing all of them explicitly would create another place to keep in mind when adding new input types in future.
from sweetalert2.
Just to clarify, are you asking about making this:
Swal.fire({
input: 'text',
inputValue: 'test',
didOpen: () => {
Swal.getInput().select()
},
})
a parameter?
from sweetalert2.
it places cursor in case of input.type !== 'file'. so for HTMLSelectElement it also places the cursor, however I'm not sure that HTMLSelectElement has a cursor? shouldn't it be changed to something like input.type === 'text' || input.type === 'textarea'?
You're right. For HTMLSelectElement it probably just silently does nothing w/o any errors or warnings.
input.type === 'text' || input.type === 'textarea'
wouldn't be enough because there are 'email', 'phone', 'password', 'search' and many others
from sweetalert2.
a parameter?
Yes, although I didn't realise that it's actually that easy to do it 🙈 I can confirm that your code solves my problem too, thanks!
Anyways I thought it might be a common use case to have the text auto selected, but whether it needs to be an option or not.. your call.
input.type === 'text' || input.type === 'textarea'
wouldn't be enough because there are 'email', 'phone', 'password', 'search' and many others
Right.. maybe it's still better to explicitly list all those types that actually support the cursor though, in order to avoid possible bugs/errors from occurring (in certain browsers)?
from sweetalert2.
Related Issues (20)
- Circle animation for success icon breaks when timing exceeds 4 seconds HOT 1
- Icons invisible with colored-toast HOT 2
- Timer doesn't seem to be working HOT 1
- Can u also update the integrations with js frameworks? HOT 1
- isVisible not false in .then() HOT 2
- Option for Page Scrolling HOT 4
- How can we add Angular component in sweetalert.
- .NET 8 Blazor - Error: There are multiple .NET runtimes present HOT 3
- support russia HOT 2
- Input Types - Email HOT 3
- Wave Tool accessibility errors SweetAlert2 HOT 1
- Partial<SweetAlertOptions> not working when using spreading operator HOT 1
- showLoaderOnConfirm not showing loader HOT 1
- ERROR ReferenceError: document is not defined at validateCustomTargetElement Angular SSR HOT 1
- Respond immediately to tap on option in inputOptions HOT 2
- Chaining modals and running modals in sequence has incorrect behaviour HOT 3
- sweetAlert2 icons showing wrong HOT 1
- ring color when focus not match with custom color button HOT 1
- Swal does not close using Swal.close() HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sweetalert2.