bndw / wifi-card

📶 Print a QR code for connecting to your WiFi (wificard.io)
https://wificard.io
MIT License
6.58k stars 460 forks source link

🐛 html direction partially broken on initial load for RTL languages #201

Closed a-tokyo closed 2 years ago

a-tokyo commented 2 years ago

Description:

– After the recent changes to htmlDirection, the initial load of the page no longer respects language direction Screenshot of broken code:

Proposed solution:

– In App.js we need to have an effect that runs on initial load and sets the direction for the whole App, not just settings component

bndw commented 2 years ago

Hi @A-Tokyo thanks for reporting this! This was likely introduced in https://github.com/bndw/wifi-card/pull/168

Proposed solution:

– In App.js we need to have an effect that runs on initial load and sets the direction for the whole App, not just settings component

I agree, since App.js is responsible for the state and rendering the children (card, settings) components, that's the right place to do the initial direction setting. Right now both components are getting the majority of their state through the settings prop, so that might be the best place to track the initial rtl state, instead of adding a new direction prop to both components.