Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upFixed issue #11651 (Do not fire a blur event when calling .focus() on… #11665
Conversation
… a focused element)
highfive
commented
Jun 7, 2016
|
Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @jdm (or someone else) soon. |
highfive
commented
Jun 7, 2016
|
Heads up! This PR modifies the following files:
|
highfive
commented
Jun 7, 2016
|
This PR could use a test. |
|
I would like to write one, but I need some hints. |
|
@paulrouget already has a test case listed in #11651. You'll need to use |
|
@davideGiovannini let me know if you need help to write the test. |
|
I haven't started reviewing the changes yet, just making note of my own investigations:
in FF, Safari, and Chrome. |
With this PR, we get the same output. I used this: <!DOCTYPE html>
<input>
<script>
var w = a => console.log(a);
var e = document.querySelector('input');
e.addEventListener("focus", function() { w('focus') });
e.addEventListener("blur", function() { w('blur') });
w('focusing');
e.focus();
w('focused');
e.focus();
w('double focused');
</script> |
|
-S-awaiting-review +S-needs-code-changes
|
|
@paulrouget Yes please, I'm not familiar with web platform tests and I'm not finding the documentation too helpful |
|
@davideGiovannini maybe this will help: https://github.com/servo/servo/blob/master/docs/HACKING_QUICKSTART.md#add-a-new-test Maybe you should create a test called |
highfive
commented
Jun 10, 2016
|
New code was committed to pull request. |
…us() on a focused element)
|
@davideGiovannini Any progress on adding tests? |
|
@bors-servo try |
Fixed issue #11651 (Do not fire a blur event when calling .focus() on… <!-- Please describe your changes on the following line: --> Added check in `HTMLElement.Focus` to avoid requesting focus when the element already has it. Added check in `Document.commit_focus_transaction` to avoid sending `blur` and `focus` events when clicking on an already focused element. --- - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #11651 <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11665) <!-- Reviewable:end -->
|
|
|
If this lands, I can write the tests in a follow-up issue right away. |
|
Sorry for the delay. |
|
I'm going to land this and track the progress of writing a test in #11854. @bors-servo r+ |
|
|
Fixed issue #11651 (Do not fire a blur event when calling .focus() on… <!-- Please describe your changes on the following line: --> Added check in `HTMLElement.Focus` to avoid requesting focus when the element already has it. Added check in `Document.commit_focus_transaction` to avoid sending `blur` and `focus` events when clicking on an already focused element. --- - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #11651 <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11665) <!-- Reviewable:end -->
|
|
|
@bors-servo retry
|
|
|
|
|
|
@bors-servo retry |
|
|
|
|
|
@bors-servo retry |
Fixed issue #11651 (Do not fire a blur event when calling .focus() on… <!-- Please describe your changes on the following line: --> Added check in `HTMLElement.Focus` to avoid requesting focus when the element already has it. Added check in `Document.commit_focus_transaction` to avoid sending `blur` and `focus` events when clicking on an already focused element. --- - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #11651 <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11665) <!-- Reviewable:end -->
|
|
Test for double focus events (covers #11665) <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #11854 (github issue number if applicable). <!-- Either: --> - [x] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11865) <!-- Reviewable:end -->
Test for double focus events (covers #11665) <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #11854 (github issue number if applicable). <!-- Either: --> - [x] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11865) <!-- Reviewable:end -->
davideGiovannini commentedJun 7, 2016
•
edited by larsbergstrom
Added check in
HTMLElement.Focusto avoid requesting focus when the element already has it.Added check in
Document.commit_focus_transactionto avoid sendingblurandfocusevents when clicking on an already focused element../mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is