RonaldJerez / vue-input-facade

A lightweight and dependency free input masking library created specific for Vue
https://ronaldjerez.github.io/vue-input-facade/latest/
183 stars 27 forks source link

fix: assume insertText if event.inputType is unsupported #33

Closed tskimmett closed 3 years ago

tskimmett commented 3 years ago

Description

Not all browsers support InputEvent.inputType (MDN). This change assumes the inputType is 'insertText' in cases where the event property is not available. This fixes problems with updating cursor position in IE11, and does not have any detrimental effects as far as I can tell.

I tweaked the existing cursor tests to also check behavior when event.inputType is not defined.

Checklist

RonaldJerez commented 3 years ago

Thanks for the PR. On the surface it looks fine and I agree it shouldn't affect anything but I vaguely recall that there was a specific reason why I didn't default it before. I think there were some interactions where even though inputType is supported it was not been populated with anything. So let me play around with it a bit and see if I can recall if that was the case before merging this.

Curious, what's the percentage of users you are still getting from IE? For our application it was less than 1% about a year ago that we just didn't bother supporting it, we present them with a dialog to upgrade to a modern browser.

tskimmett commented 3 years ago

I think there were some interactions where even though inputType is supported it was not been populated with anything

This was the only edge case I was wondering about as well, but am not familiar enough with event.inputType to know if or when that can occur.

Curious, what's the percentage of users you are still getting from IE?

I don't have usage stats in front of me, but our IE user base is significant enough to prevent us from dropping support without a more sophisticated deprecation campaign.

RonaldJerez commented 3 years ago

I played around with it a bit, couldn't reproduce the interactions, maybe it was specific browser version. I'll merge it, but I'll keep an eye on it to make sure we didn't break something else.

RonaldJerez commented 3 years ago

:tada: This PR is included in version 1.3.4 :tada:

The release is available on:

Your semantic-release bot :package::rocket: