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

[🐞] Missing code property on QwikKeyboardEvent #5189

Closed
devatina11yb opened this issue Sep 18, 2023 · 6 comments · Fixed by #5433
Closed

[🐞] Missing code property on QwikKeyboardEvent #5189

devatina11yb opened this issue Sep 18, 2023 · 6 comments · Fixed by #5433
Labels
STATUS-1: needs triage New issue which needs to be triaged TYPE: bug Something isn't working

Comments

@devatina11yb
Copy link

devatina11yb commented Sep 18, 2023

Which component is affected?

Qwik Runtime

Describe the bug

The code property is missing on QwikKeyboardEvent, I believe this is an oversight.

Reproduction

No reponse

Steps to reproduce

No response

System Info

No response

Additional Information

No response

@devatina11yb devatina11yb added STATUS-1: needs triage New issue which needs to be triaged TYPE: bug Something isn't working labels Sep 18, 2023
@mhevery
Copy link
Contributor

mhevery commented Sep 18, 2023

The code property is missing on QwikKeyboardEvent, I believe this is an oversight.

Can you provide more context....

@devatina11yb
Copy link
Author

devatina11yb commented Sep 18, 2023

The code property is missing on QwikKeyboardEvent, I believe this is an oversight.

Can you provide more context....

Sure, here is the interface for QwikKeyboardEvent taken from core.d.ts (I stripped the comments):

export declare interface QwikKeyboardEvent<T = Element> extends SyntheticEvent<T, NativeKeyboardEvent> {
    isComposing: boolean;
    altKey: boolean;
    charCode: number;
    ctrlKey: boolean;
    getModifierState(key: string): boolean;
    key: string;
    keyCode: number;
    locale: string;
    location: number;
    metaKey: boolean;
    repeat: boolean;
    shiftKey: boolean;
    which: number;
}

And here is the interface for the native KeyboardEvent taken from https://w3c.github.io/uievents/#interface-keyboardevent:

interface KeyboardEvent : UIEvent {
  // more stuff here

  readonly attribute DOMString key;
  readonly attribute DOMString code;
  readonly attribute unsigned long location;

  readonly attribute boolean ctrlKey;
  readonly attribute boolean shiftKey;
  readonly attribute boolean altKey;
  readonly attribute boolean metaKey;

  readonly attribute boolean repeat;
  readonly attribute boolean isComposing;

  boolean getModifierState(DOMString keyArg);
};

As you can see the code property is missing from QwikKeyboardEvent. I am aware it is still possible to get its value by accessing the native event with something like event.nativeEvent?.code (nativeEvent being inherited from BaseSyntheticEvent) but I believe it was supposed to be included in QwikKeyboardEvent.

You may also consider deprecating legacy properties like charCode, keyCode, and which.

@devatina11yb
Copy link
Author

devatina11yb commented Sep 18, 2023

Accidentally closed the issue.

@mhevery
Copy link
Contributor

mhevery commented Sep 19, 2023

Ohh I see.... Yes, any chance we could get you to create a PR with a fix?

@devatina11yb
Copy link
Author

Ohh I see.... Yes, any chance we could get you to create a PR with a fix?

Sure, I’ll take care of it.

@gioboa
Copy link
Member

gioboa commented Sep 20, 2023

Thanks 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
STATUS-1: needs triage New issue which needs to be triaged TYPE: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants