Skip to content

Adds an Inline Edit component #336

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

Merged
merged 13 commits into from
Jun 24, 2016
Merged

Adds an Inline Edit component #336

merged 13 commits into from
Jun 24, 2016

Conversation

tweettypography
Copy link
Contributor

Fixes #153

@jamin-hall / @minevskiy Still working on some cleanup here, but I'm opening a PR so you can take a look and let me know your feedback on the component.

@tweettypography tweettypography self-assigned this Jun 20, 2016
@tweettypography tweettypography temporarily deployed to design-system-react-com-pr-336 June 20, 2016 16:43 Inactive
@minevskiy
Copy link
Contributor

Looks good. Will it be keyboard accessible?

@tweettypography
Copy link
Contributor Author

@minevskiy It's current accessible with the following behavior: you can tab to the edit button, and hitting enter will take you to the input. Hitting tab when you finish typing will return the input to read-only state. Hitting enter will not currently end editing mode, not sure if it should or not.

Maybe @SiTaggart would have some feedback on additional accessibility needs? FYI to anyone looking into this, you can get to the live example here.

@minevskiy
Copy link
Contributor

@tweettypography , We have the following requirement from @jhausler1266 :
When inline editing a field: ESC key should cancel out of inline edit for the input in focus.

@tweettypography tweettypography temporarily deployed to design-system-react-com-pr-336 June 20, 2016 21:35 Inactive
@tweettypography
Copy link
Contributor Author

@minevskiy Updated to return to read-only mode on hitting escape, but it'd be to the consuming application to not save the changes if that's what you mean by cancel. Is the requirement that you have that this component should revert to original state when hitting escape? In that case should there be a close button (like an "x" icon) in the input while it's active to indicate it's cancellable?

@tweettypography
Copy link
Contributor Author

Note: merge #337 first as this one will likely need to be updated slightly once that goes in.

@minevskiy
Copy link
Contributor

Yes, on ESC, the input should revert to original state. And, according to W-2807690, there should also be a cancel button somewhere.

@jamin-hall
Copy link

@minevskiy is there a place where we can learn more about W-2807690? Is that a documented accessibility standard?

Would adding a "close" icon to the input appropriately address this issue?

@minevskiy
Copy link
Contributor

@jamin-hall , for more information on accessibility standard for inline input, please reach out to @jhausler1266 or @SiTaggart

# Conflicts:
#	components/forms/input/check-props.js
@tweettypography tweettypography temporarily deployed to design-system-react-com-pr-336 June 21, 2016 16:42 Inactive
@tweettypography tweettypography temporarily deployed to design-system-react-com-pr-336 June 21, 2016 16:51 Inactive
@tweettypography tweettypography changed the title Adds an Inline Edit component [HOLD] Adds an Inline Edit component Jun 21, 2016
@tweettypography tweettypography temporarily deployed to design-system-react-com-pr-336 June 21, 2016 16:58 Inactive
@tweettypography
Copy link
Contributor Author

@minevskiy / @jamin-hall: This should be ready for final review now. The close button itself isn't reachable via keyboard, but that's an accessibility bug with Input and when #315 is fixed it should fix this component too.

@jamin-hall
Copy link

@tweettypography looks good.

@minevskiy
Copy link
Contributor

minevskiy commented Jun 21, 2016

How would a consuming application determine that an edit was cancelled?

@minevskiy
Copy link
Contributor

Currently, the click is handled not just on text or icon, but to the right of the field.
edit-click-area
Is this by design? How would the consuming application restrict the click to just text and icon?

@tweettypography
Copy link
Contributor Author

@minevskiy Actually, cancelling is an unresolved issue - it sounds like based on our previous conversation I should rework this to not send the updated value until the edit ends (but is not cancelled). Is that correct?

@tweettypography
Copy link
Contributor Author

As for click locations -- current SLDS behavior is that inputs are set to 100% of their container width. So if you wanted a smaller hit area you would out the input in a smaller container. I'm not sure exactly how we would change that without adding additional markup or changing the SLDS markup. Thoughts?

@minevskiy
Copy link
Contributor

@tweettypography , yes, ideally, it should not send the updated value until the edit ends.
For click locations, is it possible to keep input width at 100%, but listen for clicks on the inner span only?
<span class="slds-form-element__static">

@tweettypography tweettypography temporarily deployed to design-system-react-com-pr-336 June 21, 2016 22:07 Inactive
@tweettypography
Copy link
Contributor Author

@minevskiy Updated to follow this pattern

@tweettypography tweettypography temporarily deployed to design-system-react-com-pr-336 June 21, 2016 22:53 Inactive
@tweettypography
Copy link
Contributor Author

Actually, looks like with the latest updates the onBlur takes precedence over the onIconClick so clicking on the cancel icon saves rather than cancels. Will have to investigate further to squash that pesky bug. Everything else should be working as expected

@minevskiy
Copy link
Contributor

looks good to me otherwise

@jwilcurt-salesforce-com
Copy link
Contributor

Design

I was given this design to reproduce. The example shown in this thread does not visually match this. Will there be a visually matching implementation of this?

@tweettypography
Copy link
Contributor Author

@jwilcurt-salesforce-com what happens when you click add?

@jwilcurt-salesforce-com
Copy link
Contributor

@tweettypography

Pop-over shows up for Description, for campaigns it will be a multi selection.

2016-06-24

@tweettypography
Copy link
Contributor Author

@jwilcurt-salesforce-com Looks that is a different pattern than the one covered by this component. You should be able to implement it already with the Popover component though.

David Brainer-Banker added 2 commits June 24, 2016 11:10
@jwilcurt-salesforce-com
Copy link
Contributor

@tweettypography

I was not referring to that, I was just answering your question.

I am refering to the underline with the pencil and the large font

"2016 Outdoors Rewards M..."

"Untitled Audiences"

Currently I have no means to create this without custom markup, css, and js.

@tweettypography tweettypography temporarily deployed to design-system-react-com-pr-336 June 24, 2016 15:54 Inactive
@tweettypography
Copy link
Contributor Author

@jwilcurt-salesforce-com Sorry! I was looking at on my phone and the line / icon were low enough contrast that I didn't even see them. I wonder if that's an accessibility issue. Anyway, the line is actually a default part of input and I intentionally disabled it because it wasn't in the the designs I received. Can you have the designer who gave you that reach out to me? As for size - you can add the class slds-text-heading--large which works before clicking edit but I'm not sure what you would do increase the size after clicking edit. You might have your designer investigate that as well

@tweettypography tweettypography temporarily deployed to design-system-react-com-pr-336 June 24, 2016 16:27 Inactive
@tweettypography
Copy link
Contributor Author

@minevskiy This should be ready for review now with the cancel button working properly

props.iconName = 'close';
props.iconPosition = 'right';
props.onIconClick = this.endEditMode;
props.onIconMouseDown = this.handleIconMouseDown;
Copy link
Contributor

Choose a reason for hiding this comment

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

Where is handleIconMouseDown defined?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not, good catch. That was left over from testing alternative methods to work around the onBlur / onClick issues.

@minevskiy
Copy link
Contributor

looks good. Thanks @tweettypography !

@tweettypography tweettypography merged commit 2b4d6a6 into salesforce:master Jun 24, 2016
@tweettypography tweettypography deleted the inline-edit branch June 24, 2016 21:53
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.

4 participants