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

Vps 058/speechtext theme #97

Merged
merged 41 commits into from
Aug 6, 2023
Merged

Vps 058/speechtext theme #97

merged 41 commits into from
Aug 6, 2023

Conversation

arnard76
Copy link
Contributor

@arnard76 arnard76 commented May 23, 2023

Describe the issue

A clear and concise description of what the issue is.

Described by #58

Describe the solution

A clear and concise description of what the solution is.

  • Creating a new component: SPEECHTEXT

  • new component looks different to the TEXT component because there is an arrow pointing to a speaker 🙂◀️

    Speechbox theme:
    image

  • Warning fixed: when using yarn, avoid using npm => Removed package-lock.json

  • Dev feature added🧑‍💻: can use absolute imports in code
    e.g. import Triangle from "components/Triangle";
    This makes it simpler to import components that are located far away from component doing the importing, but close to the src folder.
    NOTE: relative imports like this still work:
    import SpeechTextPropertiesComponent from "./ComponentProperties/SpeechTextPropertiesComponent";

  • updated snapshots for tests and fixed prior css formatting issues

Risk

Potential risks that this PR might brings

I don't know of any yet.

Definition of Done

  • Code peer-reviewed
  • Wiki Documentation is written and up to date
  • Unit tests written and passing
  • Integration tests written and passing
  • Continuous Integration build passing
  • Acceptance criteria met
  • Deployed to production environment

Reviewed By

Who reviewed your PR - for commit history once merged

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copied from TextPropertiesComponent.js but removed the border property because it doesn't apply to speech textboxes. More info in the relevant commit.

@arnard76 arnard76 linked an issue May 28, 2023 that may be closed by this pull request
1 task
NOTE: theme is the same TEXT component but that will be changed in:
Choose a speech bubble theme to add to simulator #58
Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.

fix: removing package-lock.json
for the arrow/pointing thingy in the speechbox 💬
put into component SpeechboxArrow.js

allowing absolute imports to frontend 🤯🤯😁👇

SpeechboxArrow.js will be in src/components folder but will be used from SpeechTextComponent.js (will be added in next commit 👀)

SpeechTextComponent.js & SpeechboxArrow.js are very far and using relative imports => PAIN.

followed this guide to setup absolute imports:
https://plainenglish.io/blog/why-and-how-to-use-absolute-imports-in-react
* based of text component ( + a pointer to the speaker)

updating component resolver & styles for speechtext component
…n text component

... because a textbox needs to have a border. Without a border it looks the same as textbox 🤦
div element in the new SpeechTextComponent was the first element to trigger the keypress event because it was focussable. This meant that the event.target.tagName was "DIV" & the deleteElement() function isn't called 🥲

to solve this issue 🛠️🛠️:
capture keydown event (delete) on body so event is triggered (& captured) by the body element.
because tabIndex + textbox role results in div triggering a keypress element. On the Canvas.js compenent, this results in deleteElement not being called.

fixed by removing tabIndex and role from speechbox component.

Possible TODO: All other components aren't accessable by a11y guidelines (https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) but the current way of deleting elements requires components to be non-focussable.
`flex:1` so textbox fils the entire height of the component
including a snapshot (that includes all components inside SpeechTextComponent like Triangle)
put into component SpeechboxArrow.js

allowing absolute imports to frontend 🤯🤯😁👇

SpeechboxArrow.js will be in src/components folder but will be used from SpeechTextComponent.js (will be added in next commit 👀)

SpeechTextComponent.js & SpeechboxArrow.js are very far and using relative imports => PAIN.

followed this guide to setup absolute imports:
https://plainenglish.io/blog/why-and-how-to-use-absolute-imports-in-react
* based of text component ( + a pointer to the speaker)

updating component resolver & styles for speechtext component
div element in the new SpeechTextComponent was the first element to trigger the keypress event because it was focussable. This meant that the event.target.tagName was "DIV" & the deleteElement() function isn't called 🥲

to solve this issue 🛠️🛠️:
capture keydown event (delete) on body so event is triggered (& captured) by the body element.
because tabIndex + textbox role results in div triggering a keypress element. On the Canvas.js compenent, this results in deleteElement not being called.

fixed by removing tabIndex and role from speechbox component.

Possible TODO: All other components aren't accessable by a11y guidelines (https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) but the current way of deleting elements requires components to be non-focussable.
`flex:1` so textbox fils the entire height of the component
@arnard76 arnard76 marked this pull request as ready for review July 29, 2023 05:04
@arnard76 arnard76 marked this pull request as draft July 29, 2023 05:05
put into component SpeechboxArrow.js

allowing absolute imports to frontend 🤯🤯😁👇

SpeechboxArrow.js will be in src/components folder but will be used from SpeechTextComponent.js (will be added in next commit 👀)

SpeechTextComponent.js & SpeechboxArrow.js are very far and using relative imports => PAIN.

followed this guide to setup absolute imports:
https://plainenglish.io/blog/why-and-how-to-use-absolute-imports-in-react
* based of text component ( + a pointer to the speaker)

updating component resolver & styles for speechtext component
div element in the new SpeechTextComponent was the first element to trigger the keypress event because it was focussable. This meant that the event.target.tagName was "DIV" & the deleteElement() function isn't called 🥲

to solve this issue 🛠️🛠️:
capture keydown event (delete) on body so event is triggered (& captured) by the body element.
because tabIndex + textbox role results in div triggering a keypress element. On the Canvas.js compenent, this results in deleteElement not being called.

fixed by removing tabIndex and role from speechbox component.

Possible TODO: All other components aren't accessable by a11y guidelines (https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) but the current way of deleting elements requires components to be non-focussable.
`flex:1` so textbox fils the entire height of the component
put into component SpeechboxArrow.js

allowing absolute imports to frontend 🤯🤯😁👇

SpeechboxArrow.js will be in src/components folder but will be used from SpeechTextComponent.js (will be added in next commit 👀)

SpeechTextComponent.js & SpeechboxArrow.js are very far and using relative imports => PAIN.

followed this guide to setup absolute imports:
https://plainenglish.io/blog/why-and-how-to-use-absolute-imports-in-react
* based of text component ( + a pointer to the speaker)

updating component resolver & styles for speechtext component
div element in the new SpeechTextComponent was the first element to trigger the keypress event because it was focussable. This meant that the event.target.tagName was "DIV" & the deleteElement() function isn't called 🥲

to solve this issue 🛠️🛠️:
capture keydown event (delete) on body so event is triggered (& captured) by the body element.
because tabIndex + textbox role results in div triggering a keypress element. On the Canvas.js compenent, this results in deleteElement not being called.

fixed by removing tabIndex and role from speechbox component.

Possible TODO: All other components aren't accessable by a11y guidelines (https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) but the current way of deleting elements requires components to be non-focussable.
`flex:1` so textbox fils the entire height of the component
@arnard76 arnard76 marked this pull request as ready for review July 29, 2023 05:31
index.js:1 Warning: Cannot update a component (`SpeechTextComponent`) while rendering a different component (`_c`).

*NOTE `_c` is the SpeechboxArrow component

fix 🛠️:
only set the `arrowWidth` state after component has been created using the `useEffect` hook
djos192

This comment was marked as outdated.

Copy link
Contributor

@djos192 djos192 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good

@djos192 djos192 merged commit abe1e08 into master Aug 6, 2023
6 checks passed
@harbassan harbassan deleted the VPS-058/speechtext-theme branch April 24, 2024 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Choose a speech bubble theme to add to simulator
2 participants