WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
95168
[Forms] Shift+Tab should focus the last field of multiple fields time input UI
https://bugs.webkit.org/show_bug.cgi?id=95168
Summary
[Forms] Shift+Tab should focus the last field of multiple fields time input UI
yosin
Reported
2012-08-27 21:26:08 PDT
Current implementation sets focus on the first field even if moving focus by Shift+Tab. This behavior is counterintuitive.
Attachments
Work In Progress
(45.64 KB, patch)
2012-08-28 21:01 PDT
,
yosin
no flags
Details
Formatted Diff
Diff
Patch 1
(33.44 KB, patch)
2012-08-29 22:10 PDT
,
yosin
no flags
Details
Formatted Diff
Diff
Patch 2
(36.01 KB, patch)
2012-08-30 00:51 PDT
,
yosin
no flags
Details
Formatted Diff
Diff
Patch 3
(36.07 KB, patch)
2012-08-30 00:54 PDT
,
yosin
no flags
Details
Formatted Diff
Diff
Patch 4
(37.90 KB, patch)
2012-08-30 03:57 PDT
,
yosin
no flags
Details
Formatted Diff
Diff
Patch 5
(37.90 KB, patch)
2012-08-30 04:06 PDT
,
yosin
no flags
Details
Formatted Diff
Diff
Patch 6
(39.09 KB, patch)
2012-08-30 18:43 PDT
,
yosin
no flags
Details
Formatted Diff
Diff
Patch 7
(39.27 KB, patch)
2012-08-30 19:21 PDT
,
yosin
no flags
Details
Formatted Diff
Diff
Patch 8
(37.36 KB, patch)
2012-08-30 20:31 PDT
,
yosin
no flags
Details
Formatted Diff
Diff
Patch 9
(37.44 KB, patch)
2012-08-30 20:46 PDT
,
yosin
no flags
Details
Formatted Diff
Diff
Show Obsolete
(9)
View All
Add attachment
proposed patch, testcase, etc.
yosin
Comment 1
2012-08-28 21:01:43 PDT
Created
attachment 161128
[details]
Work In Progress
yosin
Comment 2
2012-08-29 22:10:59 PDT
Created
attachment 161399
[details]
Patch 1
yosin
Comment 3
2012-08-29 22:12:14 PDT
Comment on
attachment 161399
[details]
Patch 1 Could you review this patch? Thanks in advance.
Kent Tamura
Comment 4
2012-08-29 23:54:54 PDT
Comment on
attachment 161399
[details]
Patch 1 View in context:
https://bugs.webkit.org/attachment.cgi?id=161399&action=review
> Source/WebCore/ChangeLog:14 > + current implementation, it is hard to set focus to the last field when > + it gets focus, because we don't know how DateTimeEditElement gets
gets focus by Shift+Tab ?
> Source/WebCore/ChangeLog:19 > +
You should write more details of the behavior. e.g. - HTMLInputElement for type=time is not focusable, but has a focus ring by a trick - behavior of HTMLInputElement::focus() and blur() - How 'focus' event and 'blur' event work (Also, this needs test!)
> Source/WebCore/ChangeLog:22 > + This patch also changes handling of Left/Right keys to aware text > + direction ("dir" attribute"). Left/Right keys should move focus > + physical right/left instead of logical right/left.
This should be done in a separated patch.
> Source/WebCore/html/TimeInputType.cpp:134 > + m_timeInputType.element()->setFocus(false); > +} > + > +void TimeInputType::DateTimeEditControlOwnerImpl::didFieldFocus() > +{ > + m_timeInputType.element()->setFocus(true);
I recommend adding comments about reasons why we need to call setFocus() and why they are not focus() and blur().
> Source/WebCore/html/shadow/DateTimeEditElement.h:68 > + virtual void blur() OVERRIDE FINAL; > virtual void defaultEventHandler(Event*) OVERRIDE; > void disabledStateChanged(); > + virtual void focus(bool) OVERRIDE FINAL;
DateTimeEditElement is not focusable. So, overriding blur() and focus() is not reasonable. They should not be virtual, and we should rename them to blurFromField() and focusOnTheFirstField() or something.
> Source/WebCore/html/shadow/DateTimeFieldElement.cpp:143 > +
Extra blank line
yosin
Comment 5
2012-08-30 00:51:19 PDT
Created
attachment 161418
[details]
Patch 2
yosin
Comment 6
2012-08-30 00:54:48 PDT
Created
attachment 161420
[details]
Patch 3
yosin
Comment 7
2012-08-30 00:56:39 PDT
Comment on
attachment 161420
[details]
Patch 3 Could you review this patch? Thanks in advance. = Changes since the last review = * Remove Left/Right keys motion in RTL. * Rename DateTimeEditElement::blur()/folcus() to blurByOwner()/focusByOwner() * Add comments to TImeInputType::blur()/focus() * Add a test file time-multiple-fields-blur-and-focus-events.html
Kent Tamura
Comment 8
2012-08-30 01:34:21 PDT
Comment on
attachment 161420
[details]
Patch 3 View in context:
https://bugs.webkit.org/attachment.cgi?id=161420&action=review
> Source/WebCore/ChangeLog:72 > + (WebCore::DateTimeFieldElement::focusOnNextField): Added for moving focus to next field for DateTimeNumbericFieldElment
"Added" looks incorrect. This already exists. This function is used only by DateTimeNumericFieldElement. We
> Source/WebCore/html/shadow/DateTimeEditElement.cpp:-237 > -void DateTimeEditElement::focusAndSelectSpinButtonOwner()
Don't change the function order. It makes review harder.
> Source/WebCore/html/shadow/DateTimeEditElement.cpp:275 > +size_t DateTimeEditElement::focusFieldIndex() const
focusedFieldIndex() is a better name because 'focus' looks a verb.
> Source/WebCore/html/shadow/DateTimeEditElement.cpp:284 > +DateTimeFieldElement* DateTimeEditElement::focusField() const
ditto. focusedField() is better
> Source/WebCore/html/shadow/DateTimeEditElement.cpp:383 > + if (DateTimeFieldElement* field = focusField()) { > + field->defaultEventHandler(event); > + if (event->defaultHandled()) > + return; > }
Do we need this code?
> Source/WebCore/html/shadow/DateTimeEditElement.h:68 > + void focusByOwner(bool);
The argument should be removed.
> Source/WebCore/html/shadow/DateTimeFieldElement.cpp:85 > + if (m_fieldOwner) {
nit: we prefer early-return.
> Source/WebCore/html/shadow/DateTimeFieldElement.cpp:93 > + if (m_fieldOwner) {
ditto.
> Source/WebCore/html/shadow/DateTimeFieldElement.h:54 > + virtual void didFieldBlur() = 0; > + virtual void didFieldFocus() = 0;
should be fieldDidBlur() and fieldDidFocus(), or didBlurFromField() and didFocusOnField() because 'did' should prepend to a verb.
> LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-blur-and-focus-events.html:18 > +
Need to check what happens if testInput has focus and TAB is pressed.
Kent Tamura
Comment 9
2012-08-30 01:35:01 PDT
(In reply to
comment #8
)
> (From update of
attachment 161420
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=161420&action=review
> > > Source/WebCore/ChangeLog:72 > > + (WebCore::DateTimeFieldElement::focusOnNextField): Added for moving focus to next field for DateTimeNumbericFieldElment > > "Added" looks incorrect. This already exists. > This function is used only by DateTimeNumericFieldElement. We
We had better move the function to DateTimeNumericFieldElement in another patch.
yosin
Comment 10
2012-08-30 01:56:24 PDT
(In reply to
comment #9
)
> (In reply to
comment #8
) > > (From update of
attachment 161420
[details]
[details]) > > View in context:
https://bugs.webkit.org/attachment.cgi?id=161420&action=review
> > > > > Source/WebCore/ChangeLog:72 > > > + (WebCore::DateTimeFieldElement::focusOnNextField): Added for moving focus to next field for DateTimeNumbericFieldElment > > > > "Added" looks incorrect. This already exists. > > This function is used only by DateTimeNumericFieldElement. We > > We had better move the function to DateTimeNumericFieldElement in another patch.
We have two option: 1. Having DateTimeFieldElement::focusOnNextField - current implementation PROS: Derived classes don't aware existence of DateTimeFieldOwner class. CONS: We need to add functions to DateTimeFieldElement when we have new functions in DateTimeFieldOwner class. 2. Having DateTimeFieldElement::fieldOwner() then DateTimeNumericField calls DateTimeFieldOwner::focusOnNext() via fieldOwner() function. PROS: Derived classes can use DateTimeFieldOwner functions without changing DateTimeFieldElement class CONS: We may have same code sequence, checking fieldOwner != nullptr then call fieldOwner()->function, in number of places.
Kent Tamura
Comment 11
2012-08-30 02:50:19 PDT
(In reply to
comment #10
)
> 1. Having DateTimeFieldElement::focusOnNextField - current implementation > PROS: Derived classes don't aware existence of DateTimeFieldOwner class.
I see. If you think the current structure is simpler, you don't need to move focusOnNextField(). Also, DateTimeFieldElement::defaultEventHandler() calls m_fieldOwner->focusOnNextField(*this) in the patch. It would be a justification of DateTimeFieldElement::focusOnNextField() if defaultEventHandler() used it.
yosin
Comment 12
2012-08-30 03:42:53 PDT
(In reply to
comment #8
)
> (From update of
attachment 161420
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=161420&action=review
> > > Source/WebCore/html/shadow/DateTimeEditElement.cpp:383 > > + if (DateTimeFieldElement* field = focusField()) { > > + field->defaultEventHandler(event); > > + if (event->defaultHandled()) > > + return; > > } > > Do we need this code?
Yes, for dispatching event via "input" element, e.g. input.dispatchEvent(...).
yosin
Comment 13
2012-08-30 03:57:33 PDT
Created
attachment 161438
[details]
Patch 4
yosin
Comment 14
2012-08-30 04:06:42 PDT
Created
attachment 161439
[details]
Patch 5
yosin
Comment 15
2012-08-30 04:08:53 PDT
Comment on
attachment 161439
[details]
Patch 5 Could you review this patch? Thanks in advance. = Changes since the last review = * Rename focusXXX functions/variables to focusedXXX. * Add new test time-multiple-fields-blur-and-focus-events.html * Update ChangeLog
Kent Tamura
Comment 16
2012-08-30 18:07:14 PDT
Comment on
attachment 161439
[details]
Patch 5 View in context:
https://bugs.webkit.org/attachment.cgi?id=161439&action=review
> Source/WebCore/ChangeLog:49 > + (WebCore::DateTimeEditElement::didFieldBlur): Added for calling DateTimeEditControlOwner::didFieldBlur(). > + (WebCore::DateTimeEditElement::didFieldFocus): Added for calling DateTimeEditControlOwner::didFieldFocus().
Need to update the comments.
> Source/WebCore/ChangeLog:65 > + (EditControlOwner): Added didFieldBlur() and didFieldFocus() function declarations.
Need to update the comment. Also, you should mention removed functions and their reasons.
> Source/WebCore/html/shadow/DateTimeFieldElement.h:54 > + virtual void didFocusFromField() = 0;
"focus from field" sounds strange. It should be didFocusOnField.
> LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-blur-and-focus-events.html:50 > + shouldBeEqualToString('keyDown("\t"); state()', 'blur=0 focus=1'); > + shouldBeEqualToString('keyDown("\t"); state()', 'blur=0 focus=1'); > + shouldBeEqualToString('keyDown("\t"); state()', 'blur=0 focus=1');
Oh, I thought focus and blur were dispatched in a case of focus change between internal fields. This result is nice.
yosin
Comment 17
2012-08-30 18:43:35 PDT
Created
attachment 161600
[details]
Patch 6
yosin
Comment 18
2012-08-30 18:45:09 PDT
Comment on
attachment 161600
[details]
Patch 6 Could you review this patch? Thanks in advance. = Changes since the last review = * Rename didFocusFromXXX to didFocusOnXXX * Mention removed functions in ChangeLog
Kent Tamura
Comment 19
2012-08-30 19:10:47 PDT
Comment on
attachment 161600
[details]
Patch 6 View in context:
https://bugs.webkit.org/attachment.cgi?id=161600&action=review
> Source/WebCore/ChangeLog:88 > + (WebCore::DateTimeNumericFieldElement::didBlur): Added for resetting type-ahead timer. > + (WebCore::DateTimeNumericFieldElement::didFocus): Added for resetting type-ahead timer.
Why do you need to reset it? Is this a behavior change?
> Source/WebCore/html/TimeInputType.cpp:-145 > -void TimeInputType::DateTimeEditControlOwnerImpl::focusAndSelectEditControlOwner() > +bool TimeInputType::hasCustomFocusLogic() const > { > - RefPtr<HTMLInputElement> input(m_timeInputType.element()); > - input->focus(); > - input->select();
Removing focus() and select() looks a behavior change. But ChangeLog doesn't mention it.
yosin
Comment 20
2012-08-30 19:18:28 PDT
(In reply to
comment #19
)
> (From update of
attachment 161600
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=161600&action=review
> > > Source/WebCore/ChangeLog:88 > > + (WebCore::DateTimeNumericFieldElement::didBlur): Added for resetting type-ahead timer. > > + (WebCore::DateTimeNumericFieldElement::didFocus): Added for resetting type-ahead timer. > > Why do you need to reset it? Is this a behavior change?
These changes prevent accumulating digits on following scenario: 1. Type "1" at hour field 2. Type Tab to move minute field 3. Type Shift+Tab to move hour field 4. Type "2" at hour field. When above sequence occurred in typeahead timeout, 1 sec. We expect the hour field to "2". Without these changes, the hour field is "12". This may not be happened by human action. I found this during writing layout test.
yosin
Comment 21
2012-08-30 19:21:29 PDT
Created
attachment 161605
[details]
Patch 7
yosin
Comment 22
2012-08-30 19:22:46 PDT
Comment on
attachment 161605
[details]
Patch 7 Could you review this patch? Thanks in advance. = Changes since the last review = * Mention reason of removal of DateTimeEditControlOwnerImpl::focusAndSelectEditControlOwner
Kent Tamura
Comment 23
2012-08-30 19:23:32 PDT
(In reply to
comment #20
)
> > Why do you need to reset it? Is this a behavior change? > These changes prevent accumulating digits on following scenario: > > 1. Type "1" at hour field > 2. Type Tab to move minute field > 3. Type Shift+Tab to move hour field > 4. Type "2" at hour field. > > When above sequence occurred in typeahead timeout, 1 sec. We expect the hour field to "2". Without these changes, the hour field is "12". This may not be happened by human action. I found this during writing layout test.
Does this issue exist in the current code? If so, we should not fix it in this patch.
yosin
Comment 24
2012-08-30 20:31:00 PDT
Created
attachment 161614
[details]
Patch 8
yosin
Comment 25
2012-08-30 20:31:48 PDT
(In reply to
comment #23
)
> (In reply to
comment #20
) > > > Why do you need to reset it? Is this a behavior change? > > These changes prevent accumulating digits on following scenario: > > > > 1. Type "1" at hour field > > 2. Type Tab to move minute field > > 3. Type Shift+Tab to move hour field > > 4. Type "2" at hour field. > > > > When above sequence occurred in typeahead timeout, 1 sec. We expect the hour field to "2". Without these changes, the hour field is "12". This may not be happened by human action. I found this during writing layout test. > > Does this issue exist in the current code? If so, we should not fix it in this patch.
Yes, this issue exists on the current code. I'll file another bug.
yosin
Comment 26
2012-08-30 20:33:36 PDT
Comment on
attachment 161614
[details]
Patch 8 Could you review this patch? Thanks in advance. = Change since the last patch = * Remove changes of DateTimeNumericFieldElement => will be in another patch
Kent Tamura
Comment 27
2012-08-30 20:39:30 PDT
Comment on
attachment 161614
[details]
Patch 8 View in context:
https://bugs.webkit.org/attachment.cgi?id=161614&action=review
> Source/WebCore/ChangeLog:38 > + (WebCore::TimeInputType::DateTimeEditControlOwnerImpl::focusAndSelectEditControlOwner): Removed. In this patch, settting focus to field is handled by DateTimeEditElement.
How about input->select() ? It had no effect, right?
yosin
Comment 28
2012-08-30 20:46:41 PDT
Created
attachment 161615
[details]
Patch 9
yosin
Comment 29
2012-08-30 20:47:58 PDT
Comment on
attachment 161615
[details]
Patch 9 Clearing flags on attachment: 161615 Committed
r127226
: <
http://trac.webkit.org/changeset/127226
>
yosin
Comment 30
2012-08-30 20:48:05 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug