-
Notifications
You must be signed in to change notification settings - Fork 72
[terra-time-input] - Mode changing issue on JAWS and SR fixes #2017
Conversation
@@ -436,6 +436,8 @@ TimeUtil.DoubleZeroDigit = '00'; | |||
|
|||
TimeUtil.initialValue = ['0', '00']; | |||
|
|||
TimeUtil.letterKeycode = [38, 40, 65, 66, 67, 68, 69, 70, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this array for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Safari browser allows letters when we have type as number, to prevent this we have to check all the letters keyCode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use regex like this.
let inputValue = e.target.value;
let numericValue = inputValue.replace(/[^0-9]/g, '');
e.target.value = numericValue;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
handleKeyDown event is triggering when we press any letter, so i have added regex check in keyDown event and removed keyCode array value from TimeUtil file
Left/Right Arrow key not moving the focus between the input fields. Please compare with previous functionality. |
The input element's type ('number') does not support setSelectionRange, that's why left and right arrow key is not shifting focus, i'm investigating it. |
+1 for Accessibility Review.
Issue:
|
describe('pressing -', () => { | ||
it('should roll over to 11 AM if hour and minute is at 12:00 PM', () => { | ||
browser.url('/raw/tests/cerner-terra-framework-docs/time-input/twelve-hour/filled-evening'); | ||
browser.refresh(); | ||
Terra.hideInputCaret('#timeInput input[name="terra-time-minute-time-input"]'); | ||
|
||
$('#timeInput input[name="terra-time-hour-time-input"]').click(); | ||
browser.keys('12'); | ||
browser.keys('00'); | ||
$('#timeInput input[name="terra-time-minute-time-input"]').click(); | ||
browser.keys('-'); | ||
expect($('#timeInput input[name="terra-time-hour-time-input"]')).toHaveValue('11'); | ||
expect($('#timeInput input[name="terra-time-minute-time-input"]')).toHaveValue('59'); | ||
validateElement('- causes rollover to morning'); | ||
}); | ||
|
||
it('should roll over to 11 PM if hour and minute is at 12:00 AM', () => { | ||
browser.url('/raw/tests/cerner-terra-framework-docs/time-input/twelve-hour/filled-morning'); | ||
browser.refresh(); | ||
Terra.hideInputCaret('#timeInput input[name="terra-time-minute-time-input"]'); | ||
|
||
$('#timeInput input[name="terra-time-hour-time-input"]').click(); | ||
browser.keys('12'); | ||
browser.keys('00'); | ||
$('#timeInput input[name="terra-time-minute-time-input"]').click(); | ||
browser.keys('-'); | ||
expect($('#timeInput input[name="terra-time-hour-time-input"]')).toHaveValue('11'); | ||
expect($('#timeInput input[name="terra-time-minute-time-input"]')).toHaveValue('59'); | ||
validateElement('- causes rollover to evening'); | ||
}); | ||
}); | ||
|
||
describe('pressing +', () => { | ||
it('should roll over to 12 AM if hour and minute is at 11:59 PM', () => { | ||
browser.url('/raw/tests/cerner-terra-framework-docs/time-input/twelve-hour/filled-evening'); | ||
browser.refresh(); | ||
Terra.hideInputCaret('#timeInput input[name="terra-time-minute-time-input"]'); | ||
|
||
$('#timeInput input[name="terra-time-hour-time-input"]').click(); | ||
browser.keys('11'); | ||
browser.keys('59'); | ||
$('#timeInput input[name="terra-time-minute-time-input"]').click(); | ||
browser.keys('+'); | ||
expect($('#timeInput input[name="terra-time-hour-time-input"]')).toHaveValue('12'); | ||
expect($('#timeInput input[name="terra-time-minute-time-input"]')).toHaveValue('00'); | ||
validateElement('+ causes rollover to morning'); | ||
}); | ||
|
||
it('should roll over to 12 PM if hour and minute is at 11:59 AM', () => { | ||
browser.url('/raw/tests/cerner-terra-framework-docs/time-input/twelve-hour/filled-morning'); | ||
browser.refresh(); | ||
Terra.hideInputCaret('#timeInput input[name="terra-time-minute-time-input"]'); | ||
|
||
$('#timeInput input[name="terra-time-hour-time-input"]').click(); | ||
browser.keys('11'); | ||
browser.keys('59'); | ||
$('#timeInput input[name="terra-time-minute-time-input"]').click(); | ||
browser.keys('+'); | ||
expect($('#timeInput input[name="terra-time-hour-time-input"]')).toHaveValue('12'); | ||
expect($('#timeInput input[name="terra-time-minute-time-input"]')).toHaveValue('00'); | ||
validateElement('+ causes rollover to evening'); | ||
}); | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these tests removed? Instead the click events before pressing +/- should be updated so that they match the expected output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
it('displays twelve hour meridiem - Up Arrow on hour does not change meridiem', () => { | ||
browser.url('/raw/tests/cerner-terra-framework-docs/time-input/twelve-hour/default'); | ||
browser.refresh(); | ||
Terra.hideInputCaret('#timeInput input[name="terra-time-hour-time-input"]'); | ||
|
||
$('#timeInput input[name="terra-time-hour-time-input"]').click(); | ||
browser.keys(['ArrowUp']); | ||
validateRoot('up arrow does not change meridiem'); | ||
}); | ||
|
||
it('displays twelve hour - Changes time to 01 when up is pressed on hour of 12', () => { | ||
browser.url('/raw/tests/cerner-terra-framework-docs/time-input/twelve-hour/default'); | ||
browser.refresh(); | ||
Terra.hideInputCaret('#timeInput input[name="terra-time-hour-time-input"]'); | ||
|
||
$('#timeInput input[name="terra-time-hour-time-input"]').click(); | ||
browser.keys('12'); | ||
$('#timeInput input[name="terra-time-hour-time-input"]').click(); | ||
browser.keys(['ArrowUp']); | ||
validateRoot('up arrow changes time to 01'); | ||
}); | ||
|
||
it('displays twelve hour - Changes time to 12 when down is pressed on hour of 01', () => { | ||
browser.url('/raw/tests/cerner-terra-framework-docs/time-input/twelve-hour/default'); | ||
browser.refresh(); | ||
Terra.hideInputCaret('#timeInput input[name="terra-time-hour-time-input"]'); | ||
|
||
$('#timeInput input[name="terra-time-hour-time-input"]').click(); | ||
browser.keys('01'); | ||
$('#timeInput input[name="terra-time-hour-time-input"]').click(); | ||
browser.keys(['ArrowDown']); | ||
|
||
validateRoot('down arrow changes time to 12'); | ||
}); | ||
|
||
it('displays twelve hour meridiem - Switched when up is press on hour of 11', () => { | ||
browser.url('/raw/tests/cerner-terra-framework-docs/time-input/twelve-hour/default'); | ||
browser.refresh(); | ||
Terra.hideInputCaret('#timeInput input[name="terra-time-hour-time-input"]'); | ||
|
||
$('#timeInput input[name="terra-time-hour-time-input"]').click(); | ||
browser.keys('11'); | ||
$('#timeInput input[name="terra-time-hour-time-input"]').click(); | ||
browser.keys(['ArrowUp']); | ||
|
||
validateRoot('switch meridiem - up arrow'); | ||
}); | ||
|
||
it('displays twelve hour meridiem - Switched when down is press on hour of 12', () => { | ||
browser.url('/raw/tests/cerner-terra-framework-docs/time-input/twelve-hour/default'); | ||
browser.refresh(); | ||
Terra.hideInputCaret('#timeInput input[name="terra-time-hour-time-input"]'); | ||
|
||
$('#timeInput input[name="terra-time-hour-time-input"]').click(); | ||
browser.keys('12'); | ||
$('#timeInput input[name="terra-time-hour-time-input"]').click(); | ||
browser.keys(['ArrowDown']); | ||
validateRoot('switch meridiem - down arrow'); | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update these tests so that they test the newly added functionality of the Up/Down arrow keys instead of removing them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
@@ -126,29 +66,28 @@ Terra.describeViewports('Time Input Twelve Hour', ['medium'], () => { | |||
|
|||
describe('pressing -', () => { | |||
it('should roll over to 11 AM if hour and minute is at 12:00 PM', () => { | |||
browser.url('/raw/tests/cerner-terra-framework-docs/time-input/twelve-hour/filled-evening'); | |||
browser.url('/raw/tests/cerner-terra-framework-docs/time-input/twelve-hour/default'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these URLs changed what was the issue with the existing url? I can see similar changes in other tests also
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typed input is not rendering If we use filled input field, that's why i have used default empty field test example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So that means the existing functionality is breaking. In previous implementation you could type without clearing the field. Please try to fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have verified it, previous implementation is working fine, we can able to edit filled time when we navigate using tab key, but when we click on field using mouse that time only we could not able to edit the filled time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So please look into it if that can be fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
event.currentTarget.value = ''; // eslint-disable-line no-param-reassign | ||
} | ||
|
||
if (!event.key.match(/^[0-9]/g) && !(event.keyCode === KeyCode.KEY_BACK_SPACE || event.keyCode === KeyCode.KEY_DELETE || event.keyCode === KeyCode.KEY_TAB || event.keyCode === KeyCode.KEY_RIGHT || event.keyCode === KeyCode.KEY_LEFT)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we not include Up/Down arrows here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need, because automatically Up/Down key will be increase/decrease value when we use type as number in input field
@@ -311,4 +311,10 @@ | |||
} | |||
} | |||
} | |||
// stylelint-disable property-no-vendor-prefix | |||
input::-webkit-outer-spin-button, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why was this added? Was it to suppress warning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This style was included to hide arrow icons in input field when we use type as number, it was to suppress property-no-vendor-prefix warning
d8c1171
to
885cc4d
Compare
const secondsValue = Number($('input[name="terra-time-second-input"]').getValue()); | ||
const secondsTimeValue = today.seconds(); | ||
const secondsInRange = (secondsTimeValue === secondsValue + 1 || secondsTimeValue === secondsValue); | ||
expect(secondsInRange).toBe(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why has this been removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
const secondsValue = Number($('input[name="terra-time-second-input"]').getValue()); | ||
const secondsTimeValue = today.seconds(); | ||
const secondsInRange = (secondsTimeValue === secondsValue + 1 || secondsTimeValue === secondsValue); | ||
expect(secondsInRange).toBe(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why has this been removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
it('should set date to today and now plus 1 seconds in the second input', () => { | ||
browser.url('/raw/tests/cerner-terra-framework-docs/date-time-picker/date-time-picker-with-seconds'); | ||
browser.refresh(); | ||
$('input[name="terra-time-second-input"]').click(); | ||
browser.keys('+'); | ||
|
||
const today = moment.utc().add(1, 'minutes'); | ||
const today = moment.utc().add(1, 'seconds'); | ||
expect($('input[name="terra-date-year-input"]')).toHaveValue(today.year().toString()); | ||
expect($('input[name="terra-date-month-input"]')).toHaveValue((`0${(today.month() + 1)}`).slice(-2)); | ||
expect($('input[name="terra-date-day-input"]')).toHaveValue((`0${today.date()}`).slice(-2)); | ||
expect($('input[name="terra-time-hour-input"]')).toHaveValue((`0${today.hour()}`).slice(-2)); | ||
expect($('input[name="terra-time-minute-input"]')).toHaveValue((`0${today.minute()}`).slice(-2)); | ||
const secondsValue = Number($('input[name="terra-time-second-input"]').getValue()); | ||
const secondsTimeValue = today.seconds(); | ||
const secondsInRange = (secondsTimeValue === secondsValue + 1 || secondsTimeValue === secondsValue); | ||
expect(secondsInRange).toBe(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test says that you are testing +1 sec to the seconds but I cannot see the validation for seconds field here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
const secondsValue = Number($('input[name="terra-time-second-input"]').getValue()); | ||
const secondsTimeValue = today.seconds(); | ||
const secondsInRange = (secondsTimeValue === secondsValue + 1 || secondsTimeValue === secondsValue); | ||
expect(secondsInRange).toBe(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test says that you are testing +1 sec to the seconds but you have removed seconds field validation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
Summary
What was changed:
number
instead of text.Why it was changed:
Testing
This change was tested using:
Reviews
In addition to engineering reviews, this PR needs:
Additional Details
This PR resolves:
UXPLATFORM-6328
Thank you for contributing to Terra.
@cerner/terra
Before fix :
After Fix :