Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clearing input cancel list in Element Send Keys #1809

Open
grokys opened this issue May 6, 2024 · 4 comments
Open

Clearing input cancel list in Element Send Keys #1809

grokys opened this issue May 6, 2024 · 4 comments

Comments

@grokys
Copy link

grokys commented May 6, 2024

Element Send Keys details the following steps:

  1. Let source be the result of create an input source with input state, and "key".
  1. Add an input source with input state, input id and source.
  1. Dispatch actions for a string with arguments input state, input id, and source, text, and session's current browsing context.
  1. Remove an input source with input state and input id.

Dispatch actions for a string then eventually dispatches keyDown actions, which in dispatch tick actions says:

If subtype is "keyDown", append a copy of action object with the subtype property changed to "keyUp" to input state’s input cancel list.

Once that is done we arrive at step 14 in Element Send Keys: Remove an input source. This says:

Assert: None of the items in input state's input cancel list has id equal to input id.

But I can't find the place in the spec where the input cancel list should be cleared: the only reference to clearing the input cancel list is in Release Actions.

grokys added a commit to grokys/FlaUI.WebDriver that referenced this issue May 6, 2024
As far as I can see this failing test is caused by a defect in the spec w3c/webdriver#1809?
@grokys
Copy link
Author

grokys commented May 8, 2024

I suspect that "undo actions" in dispatch actions for a string may be a vestige from an older version of the spec for two reasons:

  • There is already an "undo actions" list in the form of the "input cancel list"
  • It's a map of "cluster" to "action" but "cluster" is never used (i.e. it's used as a simple list, not a map)
  • If we clear the "input cancel list" (instead of "undo actions") in "clear the modifier key state" this problem goes away

grokys added a commit to grokys/FlaUI.WebDriver that referenced this issue May 8, 2024
@ChernyshevDS
Copy link
Contributor

ChernyshevDS commented Jun 7, 2024

@grokys Hello. I'm struggling with the same task as you trying to implement actions handling according to the spec, and I think the spec has a bigger flaw, that confused you and me regarding the input cancel list, and considering you spent your time scrutinizing the spec I'll be grateful for your feedback on my thoughts.

Any key down action (not only modifiers) dispatched with dispatch tick actions adds a key up action to input cancel list, which is global for all input state, not a particular input source. However, the only method to remove actions from this list is release actions. I beleive, dispatching a key up action should remove corresponding actions from input cancel list, otherwise we end up with a lot of duplicated key up actions on release actions. Same goes for pointer up actions.

Looking at the description of a dispatch actions for a string, we can see that undo actions hold only modifier keys state for a temporary key input source, created in element send keys, and these modifiers are cleared at the end of element send keys, so I do not agree with you that input cancel list may be used to clear modifiers state.

Adding to a confusion here: we have a global key state, which combines the state of possibly multiple key input sources, but it's not used during key events processing. Let's assume that we called perform actions with shift key down event. After the processing the input state contains one key input source with shift property set to true. Shouldn't this shift property be taken into account somehow if we call element send keys next? No idea...

@ChernyshevDS
Copy link
Contributor

Found another inconsistency in spec: dispatch actions for a string appends shift key down actions for shifted characters thus adding cancelling shift key up to input cancel list, although in this context the undo actions map should be used, otherwise these actions are not executed in clear modifiers key state.

@stp-ekioh
Copy link

Am trying to implement this specification and have run into the same issue - does anyone involved with the spec have any comment on this? Are the specs still being updated?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants