Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

postcalc.usps.com - see bug description #8699

Closed
webcompat-bot opened this issue Aug 5, 2017 · 5 comments
Closed

postcalc.usps.com - see bug description #8699

webcompat-bot opened this issue Aug 5, 2017 · 5 comments
Labels
browser-firefox engine-gecko The browser uses the Gecko rendering engine severity-minor The site has a cosmetic issue.
Milestone

Comments

@webcompat-bot
Copy link

URL: https://postcalc.usps.com/Calculator/ShapeAndSize?country=0&ccode=US&oz=94041&omil=False&dz=92103&dmil=False&mdt=8%2F5%2F2017&mdz=11%3A59&m=0

Browser / Version: Firefox 54.0
Operating System: Ubuntu
Tested Another Browser: Yes

Problem type: Something else
Description: When I enter a larger weight than allowed (205) backspace stops working in the pounds box.
Steps to Reproduce:

  1. Go to this url:

https://postcalc.usps.com/Calculator/ShapeAndSize?country=0&ccode=US&oz=94041&omil=False&dz=92103&dmil=False&mdt=8%2F5%2F2017&mdz=11%3A59&m=0

  1. In the pounds box enter "205" (or any other large number)

  2. Try pressing backspace

From webcompat.com with ❤️

@MDTsai
Copy link

MDTsai commented Aug 7, 2017

Confirmed, I can reproduce using Firefox 57 on Linux. Move to needsdiagnosis.

@wisniewskit
Copy link
Member

wisniewskit commented Aug 22, 2017

This looks like a site script bug. The problem is here in their HTML:

  <script type="text/javascript">
    $(document).ready(function () {
      $('.numeric-only').keypress(function (e) { NumberOnly(e); });
      $('.decimal-only').keypress(function (e) { DecimalOnly(e); });
    });

    function NumberOnly(e) {
      var verified = (e.which == 8 || e.which == undefined || e.which == 0) ? null : String.fromCharCode(e.which).match(/[^0-9]/);
      if (verified) { e.preventDefault();
      }
    }

    function DecimalOnly(e) {
      var verified = (e.which == 8 || e.which == undefined || e.which == 0) ? null : String.fromCharCode(e.which).match(/[0-9]|[.]/);
      if (!verified) { e.preventDefault(); }
    }
  </script>

Note that only Firefox sends keypress events for backspace and other control keys these days, so only it will end up calling this code. And here they're expressly forbidding backspace (e.which==8), as well as control keys (e.which==0). As such only Firefox will be affected by this bug.

In fact, to me it looks like they were trying to account for this browser difference, but ended up writing the reverse logic that they intended. This should work just fine (in both of those event handlers):

      var verified = e.which == 8 || e.which == undefined || e.which == 0 || String.fromCharCode(e.which).match(/[0-9]|[.]/);

Note that bug 968056 is about fixing this old interop issue, so I'll mark this as a dupe of that, but also as needscontact due to having a workaround.

@adamopenweb
Copy link
Collaborator

Maybe not worth contacting the site now, since we are trying to land a fix for https://bugzilla.mozilla.org/show_bug.cgi?id=968056.

When testing with
dom.keyboardevent.keypress.dispatch_non_printable_keys_only_system_group_in_content set to true, the backspace key works as expected.

@adamopenweb
Copy link
Collaborator

adamopenweb commented Apr 10, 2018

Setting this as severity-minor until we've figured out https://bugzilla.mozilla.org/show_bug.cgi?id=968056.

@adamopenweb adamopenweb added the severity-minor The site has a cosmetic issue. label Apr 10, 2018
@miketaylr miketaylr added the engine-gecko The browser uses the Gecko rendering engine label Apr 30, 2019
@softvision-sergiulogigan

This seems to be fixed now.

Tested with:
Browser / Version: Firefox Nightly 72.0a1 (2019-11-03)
Operating System: Linux Mint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
browser-firefox engine-gecko The browser uses the Gecko rendering engine severity-minor The site has a cosmetic issue.
Projects
None yet
Development

No branches or pull requests

6 participants