Git Product home page Git Product logo

gold-cc-expiration-input's Introduction

Published on NPM Build status Published on webcomponents.org

##<gold-cc-expiration-input>

gold-cc-expiration-input is a single-line text field with Material Design styling for entering a credit card's expiration date See: Documentation, Demo.

Changes in 3.0

  • date-input will no longer fire the dateChanged event.
    • Instead listen to the non-bubbling date-changed event.
  • Values set delcaratively will be visible.

Usage

Installation

npm install --save @polymer/gold-cc-expiration-input

In an html file

<html>
  <head>
    <script type="module">
      import '@polymer/gold-cc-expiration-input/gold-cc-expiration-input.js';
    </script>
  </head>
  <body>
    <gold-cc-expiration-input></gold-cc-expiration-input>
    <gold-cc-expiration-input value="11/15"></gold-cc-expiration-input>
    <gold-cc-expiration-input label="Date"></gold-cc-expiration-input>
  </body>
</html>

In a Polymer 3 element

import {PolymerElement, html} from '@polymer/polymer';
import '@polymer/gold-cc-expiration-input/gold-cc-expiration-input.js';

class SampleElement extends PolymerElement {
  static get template() {
    return html`
      <gold-cc-expiration-input></gold-cc-expiration-input>
      <gold-cc-expiration-input value="11/15"></gold-cc-expiration-input>
      <gold-cc-expiration-input label="Date"></gold-cc-expiration-input>
    `;
  }
}
customElements.define('sample-element', SampleElement);

Contributing

If you want to send a PR to this element, here are the instructions for running the tests and demo locally:

Installation

git clone https://github.com/PolymerElements/gold-cc-expiration-input
cd gold-cc-expiration-input
npm install
npm install -g polymer-cli

Running the demo locally

polymer serve --npm
open http://127.0.0.1:<port>/demo/

Running the tests

polymer test --npm

gold-cc-expiration-input's People

Contributors

aomarks avatar bicknellr avatar dfreedm avatar e111077 avatar garlicnation avatar notwaldorf avatar rictic avatar rmayhue avatar samuelli avatar srikkbhat avatar tedium-bot avatar tjsavage avatar tyriar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

gold-cc-expiration-input's Issues

gold-cc-expiration-input accessibility issues

Issues with the hint text:
On Chrome / Mac / VoiceOver: The hint text for MM / YY is reading as "blank".
On Chrome on Windows with NVDA, it just reads as "edit" without any context of the hint text.
On Firefox with NVDA, the experience is similar and reads as "edit" but also speaks "has auto complete" which I don't think is true.

Please note that Chrome OS + ChromeVox is able to read the hint text MM / YY just fine, but this is not the case on other OS / browser / screen reader combos.

Contrast: the contrast of the hint text for MM / YY is poor. Please make the text a bit darker.

Audit results:
[Severe] Controls and media elements should have labels (8)
[Warning] Text elements should have a reasonable contrast ratio (6)
Not applicable tests (9)

on load, value is not displayed

Go to component demo page - none of the fields are pre-filled, even though they have value attribute set.

The result of this bug is that on a form, this control has value set, but looks like it needs to be filled out / blank.

Polymer 2?

Has this element (or all the Gold elements for that concern) been deprecated?
If not will they be upgraded to Polymer 2?
I don't see any branch letting me suppose so at the moment

No named form element

When supplying a 'name' attribute to gold-cc-expiration-input, it does not appear to be reflected on any contained html form element. Consequently it is not possible to get a value using form.<element_name>.value

Realise there is some complexity here given that there are actually 2 inputs, but it's a little unintuitive given that other form elements do not have this behaviour/constraint. Perhaps there should be a hidden form element whose name/value achieve the desired outcome?

Incorrect focus handling

Tabbing into this input from another input, first shows focus rectangle around whole control, instead of setting focus into month field.

Tested on Chrome.

Input value is not actual

Description

Check this jsbin https://jsbin.com/ginujab/edit?html,output
At the beginning input has a value "02/24"
When I erase "4" value becomes "02/2"
When I erase last digit - "2" - input value does not change and remains "02/2"
Even if I delete everything from input, value remains "02/2"
It happens because of this condition in the code https://github.com/PolymerElements/gold-cc-expiration-input/blob/master/gold-cc-expiration-input.html#L151

Expected outcome

As a developer, when user deletes some digits, I want to get actual value which is in the input, even if value is invalid.

Actual outcome

When user deletes some digits, I get some strange non-actual and invalid value "02/2" even if there's nothing in inputs or only "0" or "02"..

Live Demo

https://jsbin.com/ginujab/edit?html,output

Steps to reproduce

Check this jsbin https://jsbin.com/ginujab/edit?html,output
At the beginning input has a value "02/24"
Erase "4" - value will become "02/2"
Erase last digit - "2" - input value will not change and will remain "02/2"
Even if you delete everything from input, value remains "02/2"

Browsers Affected

  • Chrome
  • Firefox
  • Safari 9
  • Safari 8
  • Safari 7
  • Edge
  • IE 11
  • IE 10

Doesn't accept numpad entry

(Issue based off Polymer website demo at time of entry)

gold-cc-expiration-input does not accept numbers typed via the numpad as valid.

[1.0.3] Bottom line got lower

In my project on Chrome, version 1.0.3 the bottom line is lower than in other paper-input based elements. This is noticeable when placing gold-cc-expiration-input in the same row as another input. version 1.0.2 looks fine on Chrome. On Firefox both versions have too low bottom line.
In https://github.com/notwaldorf/polymer-gold-elements-demo both versions look fine on Chrome and with too low bottom line on Firefox.
After comparing my project with the gold elements demo it turns out that with paper-input 1.0.0 dependency is what makes gold-cc-expiration-input look fine on Chrome. paper-input 1.0.3 causes the too low bottom line on Chrome. Either way on Firefox this always happens.

polylint errors

gold-cc-expiration-input/date-input.html:58:7
    Property 'disabled' bound to attribute 'disabled$' not found in 'properties' for element 'date-input'
gold-cc-expiration-input/date-input.html:58:7
    Property 'autofocus' bound to attribute 'autofocus$' not found in 'properties' for element 'date-input'
gold-cc-expiration-input/date-input.html:58:7
    Property 'inputmode' bound to attribute 'inputmode$' not found in 'properties' for element 'date-input'
gold-cc-expiration-input/date-input.html:58:7
    Property 'placeholder' bound to attribute 'placeholder$' not found in 'properties' for element 'date-input'
gold-cc-expiration-input/date-input.html:58:7
    Property 'readonly' bound to attribute 'readonly$' not found in 'properties' for element 'date-input'
gold-cc-expiration-input/date-input.html:75:7
    Property 'disabled' bound to attribute 'disabled$' not found in 'properties' for element 'date-input'
gold-cc-expiration-input/date-input.html:75:7
    Property 'autofocus' bound to attribute 'autofocus$' not found in 'properties' for element 'date-input'
gold-cc-expiration-input/date-input.html:75:7
    Property 'inputmode' bound to attribute 'inputmode$' not found in 'properties' for element 'date-input'
gold-cc-expiration-input/date-input.html:75:7
    Property 'placeholder' bound to attribute 'placeholder$' not found in 'properties' for element 'date-input'
gold-cc-expiration-input/date-input.html:75:7
    Property 'readonly' bound to attribute 'readonly$' not found in 'properties' for element 'date-input'

Move <script> inside <dom-module>

gold-cc-expiration-input's code is not following the same standards as other elements. gold-cc-expiration-input's javascript code is outside the . All other elements have javascript code inside the tags

Current gold-cc-expiration-input code:

...
<dom-module>
   ...
</dom-module>
<script>
   ...
</script>

Expected:

...
<dom-module>
   ...
   <script>
      ...
   </script>
</dom-module>

A similar issue has been fixed for other elements like paper-fab. Please check PolymerElements/paper-fab#53 for details.

Label is floating always, no-label-float and always-float-label are ignored

Label is always floating in gold-cc-expiration-input

You can see here in code https://github.com/PolymerElements/gold-cc-expiration-input/blob/master/gold-cc-expiration-input.html#L63 that always-float-label is always set.

<paper-input-container id="container"
        always-float-label
        attr-for-value="date"

For example, in gold-cc-input everything is OK
https://github.com/PolymerElements/gold-cc-input/blob/master/gold-cc-input.html#L87

<paper-input-container id="container"
   disabled$="[[disabled]]"
   no-label-float="[[noLabelFloat]]"
   always-float-label="[[_computeAlwaysFloatLabel(alwaysFloatLabel,placeholder)]]"

Please, make no-label-float working for gold-cc-expiration-input
All other gold inputs make label floating only when user inputs data, this input label is floating always.

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.