Skip to content

Events double fired in Root and @keyframes render to string with <Style> as [object Object] #10

Closed
@kurdin

Description

@kurdin

Thanks for nice lib and I found 2 issues with react-shade:

  1. All events in Root is double fired

in simple app like this, I see TEST Clicked logged twice in console

render(
  <Root>
    <button
      onClick={() => {
        console.log('TEST Clicked');
      }}
    >
      TEST
    </button>
  </Root>,
  $root
);

to fix this, I had to remove retarget method in Root.ts line 40 // retarget(shadowRoot);
and fix line 57 {state.shadowRoot && createPortal(props.children, state.shadowRoot)}

  1. If I use styles object with @keyframe or @media props in <Style> component, their content renders in style's tag as [object Object] because it has deeper nested object then regular style's rule. I found work around by moving all @keyframe or @media directly to <styles> but I think you need to fix it somewhere in internal/css.ts by checking if value is Object then do another Object.keys if it is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions