-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
🪟 🎉 Replace multiline + hidden connector field with SecretTextArea
component
#16539
Conversation
42929d4
to
3a75361
Compare
onClick={() => { | ||
toggleIsContentVisible(); | ||
}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit/Optional:
onClick={() => { | |
toggleIsContentVisible(); | |
}} | |
onClick={toggleIsContentVisible} |
onBlur?: React.FocusEventHandler<HTMLDivElement>; | ||
} | ||
|
||
export const TextInputContainer: React.FC<TextInputContainerProps> = ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you planning to extend this component's usage? Because the secret text area only uses some of these props and it looks like it isn't used elsewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this will eventually be shared by the input component but the change will be done separately.
Tested functionality locally in OSS: |
@@ -89,6 +89,7 @@ export const Input: React.FC<InputProps> = ({ light, error, ...props }) => { | |||
{ | |||
[styles.disabled]: props.disabled, | |||
[styles.password]: isPassword, | |||
"fs-exclude": isPassword, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we maybe make this class an export from some (ts) file, to have it more verbose in those places what it does? Alternatively I'd suggest we add a comment here, so that if we read that in the future, won't need to google what that class does :)
@@ -0,0 +1,21 @@ | |||
@use "../../../scss/colors"; | |||
|
|||
button.toggleVisibilityButton { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we usually have classNames only, is there a specific reason we're going with button.toggleVisibilityButton
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No good reason. I may have done this during the early commits and forgot to remove it.
extends Omit<TextInputContainerProps, "onFocus" | "onBlur">, | ||
React.TextareaHTMLAttributes<HTMLTextAreaElement> {} | ||
|
||
export const SecretTextArea: React.VFC<SecretTextAreaProps> = ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export const SecretTextArea: React.VFC<SecretTextAreaProps> = ({ | |
export const SecretTextArea: React.FC<SecretTextAreaProps> = ({ |
So we're not introducing new deprecated API with the React 8 upgrade please (also see this Slack message).
className={styles.passwordInput} | ||
readOnly | ||
aria-hidden | ||
data-testid="input" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we maybe make those testids a bit more verbose, e.g. data-testid="secretTextArea-input"
, that would help us later to better target them (in any tool) if we'd need to. (And similar for the testid above)
I ❤️ this approach. I think this will really improve this component significantly. |
airbyte-webapp/src/components/base/SecretTextArea/SecretTextArea.tsx
Outdated
Show resolved
Hide resolved
3a75361
to
83e1048
Compare
83e1048
to
61c76ec
Compare
* Add TextInputContainer to manage the look and feel of inputs and text area * Update multiline + secret controls to use it
09ba793
to
d8e60d6
Compare
…component (airbytehq#16539) * Add SecretTextArea component * Add TextInputContainer to manage the look and feel of inputs and text area * Update multiline + secret controls to use it * Fix SecretTextArea story * Add .fs-exclude class to SecretTextArea and Password input * Use scss color * Add tests for SecretTextArea component * Update SecretTextArea testIds * Remove specificity in secrettextarea rule * Update type to be compatible with React 18 * Move SecretTextArea and TextInputContainer to components/ui
What
Resolves #16307
This change updates the rendering of multiline + secret connector field with a customized
SecretTextArea
component that handles the text more securely:Screen.Recording.2022-09-09.at.12.12.55.mov
How
SecretTextArea
stores the value inside a hidden<input type="password" />
field until it becomes visible. The data is then moved to atextarea
for editing.The component is wrapped around a
TextInputContainer
element which applies the correct styles to make it like the other fields. This new component could also be used for theInput
andTextArea
components.Recommended reading order
SecretTextArea.tsx
Control.tsx
WIP - TODO