-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix(select): revert commit to fix skipping over blank disabled options #8221
Conversation
Thanks for the PR! Please check the items below to help us merge this faster. See the contributing docs for more information.
If you need to make changes to your pull request, you can update the commit with Thanks again for your help! |
Please use I'm all for reverting it, so LGTM |
Using git revert is not only for consistency, it also makes it easy to find the actual reverted commit. However, you need a separate commit for the tests in this case. |
yes, I think we want to reverts here (or maybe I'm wrong, it's been months!) |
different shas in master and v1.2.x |
Yes @Narretz, I filed a bug with Firefox. @IgorMinar is also looking at how to fix the original issue. |
PS @ealtenho do you have a link to the bugzilla bug? I'd like to be CC'd on that |
bugzilla link: https://bugzilla.mozilla.org/show_bug.cgi?id=1039047 |
@caitp @IgorMinar how do these look? Actually, I hadn't updated the comment for the second commit. I think it now has the right message. |
we don't want to revert this:
|
otherwise it looks good |
So I was looking at the spec, and it looks like FF is actually totally compliant with the requirements laid out for it (re: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html). This is implementation-defined behaviour, so to get it fixed in gecko we really need to make a case for it --- I think we have a case here, but it could very well be WONTFIX'd. Some mozillians spoken to seem to agree that it's a bug, while some consider it a feature, and the spec just doesn't care one way or the other. I guess we'll see how it goes |
@IgorMinar, so it's okay to have a failing test in the PR at this point? I know that the test is still necessary, but I wasn't sure if it should be left if this PR does not contain a fix? @caitp is there any action I should take then on the bug report? Like elaborating how this behavior affects us? |
So, @sideshowbarker seems to agree that it's a weird user experience, and Olli Pettay seems to be at least satisfied that browser interop is an issue which should be addressed. I've chosen to describe the behaviour as reading a menu in a restaurant and having your credit card charged as soon as you gaze at an item, before actually committing to a decision about your order. Analogies like that might be helpful in explaining why it's a problem, and an explanation as to why we sometimes consider values before the user actually chooses one (eg during digest) would be helpful too. But frankly, the reproduction is pretty solid and clearly shows the problems with this behaviour, so that should be more than enough. One thing though, mobile devices (with touch screens) are really a huge priority for pretty much all of the different vendors right now, so it can be hard to explain problems which affect actual pointing devices (this problem won't occur on mobile, since there's no real "hover" scenario on mobile). |
@IgorMinar I changed the revert to preserve the failing test. |
so I guess that bug is a duplicate of a bug opened in 2007 (the search terms I went for didn't include "dropdown menu", so I did't see it before)... that somewhat shrinks my hopes that it will be fixed quickly :( That's a shame. |
Well that bug is marked as blocking a couple other more recent bugs, so I’d think that increases the chances of a change being made sooner than the 2007 date would suggest. https://bugzilla.mozilla.org/showdependencytree.cgi?id=987143&hide_resolved=1 |
@ealtenho we should make a separate commit to add the |
@jeffbcross I had a discussion with @btford and @IgorMinar about this yesterday and my understanding was that I was submitting this PR partially so @IgorMinar could work on addressing the failing test case.
should I implement this? |
@ealtenho - I would definitely do this. It is much easier to understand the failing test if it is not hidden inside some partially reverted commit. |
@IgorMinar - I have assigned this to me for tomorrow. If you want it back just say; if I don't make any progress tomorrow then I'll assign it back to you myself :-) |
Please take a look at my fix for this: #8367 |
…render This reverts commit dc149de. That commit fixes a bug caused by Firefox updating `select.value` on hover. However, it causes other bugs with select including the issue described in angular#7715. This issue details how selects with a blank disabled option skip to the second option. We filed a bug with Firefox for the problematic behavior the reverted commit addresses https://bugzilla.mozilla.org/show_bug.cgi?id=1039047, and alternate Angular fixes are being investigated. Closes angular#7715 angular#7855
…ith no change event Commit dc149de was reverted to fix regressions angular#7715 and angular#7855. This commit introduced this test case and a corresponding fix for preventing the update of the selected property of an option element on a digest with no change event. Although the previous fix introduced regressions, the test covers a valid issue and should be included.
An earlier commit dc149de caused an error where the first option of a select would be skipped over if it had a blank disabled value. These tests demonstrate that with that commit in place, blank disabled options are skipped in a select. When the commit is reverted, the correct behavior is seen that the blank disabled option is still selected in both selects marked with required and those that have optional choices. Relates to angular#7715
A regression angular#7855 was introduced by angular@dc149de This test ensures that reverting that commit fixes this regression. In the regression, changes to a bound model in ng-change were not propagated back to the view. Test for angular#7855
…digest with no change event The `render()` method was being invoked on every turn of the digest cycle, which was inadvertently updating the DOM even when a `change` event had not been triggered. This change only calls the `render()` method when `ctrl.$render()` is called, as part of the NgModelController` lifecycle and when the `modelValue` has significantly changed.
@ealtenho - LGTM. Let's get a check from one of the core team. |
// TODO(vojta): can't we optimize this ? | ||
scope.$watch(render); | ||
scope.$watch(valuesFn, render, true); | ||
scope.$watch(getSelectedSet, render, 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.
Does this mean that you can conceivably render() multiple times per digest (not including retrying dirtychecking)?
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.
Well previously render()
was being called a minimum of 2 times for every digest, whether or not there was a change to any of the model values.
I initially put these into a watchGroup()
call but that doesn't have a parameter to watch deeply.
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.
but we shouldn't really need deep watching afaik? since we only test if values are the same with identity equality anyhow
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.
or is something different now that we do need to do that
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.
The deep watches are needed because we need to re-render if the list of options changes (valuesFn
).
Also, the selectedSet
is recreated every time and so we need to check whether its properties have changed.
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'm not really sold on that approach.
Previously, we were doing this work in the watch expression, and knew specifically which options changed and how.
Now, we're deep-watching with the same watch action twice, without knowing what's changed and what hasn't. For small collections of options it won' t matter, so if we're shipping this, really emphasize that it's not intended for large collections or complex collections of options
…digest with no change event The `render()` method was being invoked on every turn of the digest cycle, which was inadvertently updating the DOM even when a `change` event had not been triggered. This change only calls the `render()` method when `ctrl.$render()` is called, as part of the NgModelController` lifecycle and when the `modelValue` has significantly changed. Closes #8221 Closes #7715
An earlier commit caused an error where the first option of a select would be skipped
over if it had a blank value. This fix adds a test case to identify this case and shows
that reverting the earlier commit causes the behavior to change.
Relates to #7715