mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Auto merge of #11665 - davideGiovannini:master, r=KiChjang
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 -->
This commit is contained in:
commit
7d978e7b3d
1 changed files with 3 additions and 0 deletions
|
@ -599,6 +599,9 @@ impl Document {
|
|||
/// Reassign the focus context to the element that last requested focus during this
|
||||
/// transaction, or none if no elements requested it.
|
||||
pub fn commit_focus_transaction(&self, focus_type: FocusType) {
|
||||
if self.focused == self.possibly_focused.get().r() {
|
||||
return
|
||||
}
|
||||
if let Some(ref elem) = self.focused.get() {
|
||||
let node = elem.upcast::<Node>();
|
||||
elem.set_focus_state(false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue