Bug 1249556 - Implement toggling details by keyboard. r=smaug
The user can switch to the main <summary> by tab key, and toggle the <details> by either 'space' key or 'enter' key. 'return' key is handled with 'keypress', and the 'space' key is handled with 'keyup' like the HTMLInputElement. MozReview-Commit-ID: HE6IduUGCpj
This commit is contained in:
@@ -292,15 +292,8 @@ HTMLButtonElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||
eKeyPress == aVisitor.mEvent->mMessage) ||
|
||||
(keyEvent->keyCode == NS_VK_SPACE &&
|
||||
eKeyUp == aVisitor.mEvent->mMessage)) {
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
|
||||
WidgetMouseEvent event(aVisitor.mEvent->mFlags.mIsTrusted,
|
||||
eMouseClick, nullptr,
|
||||
WidgetMouseEvent::eReal);
|
||||
event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_KEYBOARD;
|
||||
EventDispatcher::Dispatch(static_cast<nsIContent*>(this),
|
||||
aVisitor.mPresContext, &event, nullptr,
|
||||
&status);
|
||||
DispatchSimulatedClick(this, aVisitor.mEvent->mFlags.mIsTrusted,
|
||||
aVisitor.mPresContext);
|
||||
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user