Skip to content

Textbox improvements - #981

Merged
shiftkey merged 24 commits into
masterfrom
textbox-improvements
Feb 27, 2017
Merged

shiftkey merged 24 commits into
masterfrom
textbox-improvements

Conversation

@niik

@niik niik commented Feb 24, 2017 •

Copy link
Copy Markdown
Member

These are changes that I need for #961 but I'm breaking them out to make it a little easier to review.

This reworks the TextBox component to only render a label element if a label text has been provided. It also adds the ability for us to incorporate a label link element as seen below. This matches the behavior of GitHub.com.

image

In order to be able to unwrap the input element from the label I had to use the for attribute to associate the two and thus I needed a unique html id for the input element. Rather than requiring one to be passed down I first opted for a simple uuid but later refined it a little to be able to generate semi-readable unique ids.

image

@niik niik changed the title [WIP] Textbox improvements Textbox improvements Feb 24, 2017
@niik

niik commented Feb 24, 2017

Copy link
Copy Markdown
Member Author

Ready for review!

@niik niik mentioned this pull request Feb 24, 2017

@shiftkey shiftkey left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Left some comments. No blockers. Happy to add any changes into #961 instead of here.

Comment thread app/src/ui/lib/id-pool.ts

if (__DEV__) {
if (activeIds.size > 50) {
console.warn(`Id pool contains ${activeIds.size} entries, it's possible that id's aren't being released properly.`)

This comment was marked as spam.

*
* This differs from the onChange event in that it passes only the new
* value and not the event itself. Subscribe to the onChange event if you
* need the ability to prevent the action from occurring.

This comment was marked as spam.

label='Password'
type='password'
disabled={disabled}
onChange={this.onPasswordChange}

This comment was marked as spam.

This comment was marked as spam.

* An optional className to be applied to the rendered
* top level element of the component.
*/
readonly className?: string

This comment was marked as spam.

Comment thread app/src/ui/lib/text-box.tsx Outdated
/**
* An automatically generated id for the input element used to reference
* it from the label element. This is generated once when the component
* is mounted.

This comment was marked as spam.

Comment thread app/src/ui/lib/text-box.tsx Outdated
* An optional text for a link label element. A link label is, for the purposes
* of this control an anchor element that's rendered alongside (ie on the same)
* row as the the label element. The link label will only be rendered if the
* textbox has a label text. This is used for presenting the user with a contextual

This comment was marked as spam.

@shiftkey shiftkey self-assigned this Feb 27, 2017
@niik

niik commented Feb 27, 2017

Copy link
Copy Markdown
Member Author

🔵

@shiftkey
shiftkey merged commit f71546c into master Feb 27, 2017
@shiftkey
shiftkey deleted the textbox-improvements branch February 27, 2017 10:55
@niik niik mentioned this pull request Apr 11, 2017
niik added a commit that referenced this pull request Jun 29, 2022
This was introduced in #981 and is only used in one location, 2FA input. As 2FA input in app is exceedingly rare these days with mandatory web flow login we can remove it and at the same time solve a layout issue with very long labels which would previously overflow.
s7ab059789 pushed a commit to s7ab059789/desktop that referenced this pull request Sep 18, 2022
This was introduced in desktop#981 and is only used in one location, 2FA input. As 2FA input in app is exceedingly rare these days with mandatory web flow login we can remove it and at the same time solve a layout issue with very long labels which would previously overflow.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants