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

feat(Input): add focus() method #1477

Merged
merged 3 commits into from
Mar 18, 2017
Merged

feat(Input): add focus() method #1477

merged 3 commits into from
Mar 18, 2017

Conversation

levithomason
Copy link
Member

@levithomason levithomason commented Mar 18, 2017

Fixes #1475

A ref on a composite component (like the Input) will return a reference to the class instance. This PR adds a focus method to the Input that focuses the HTML input. This allows users to call focus() on the Input ref and it will focus the internal HTML input element.

An example and test was also added.

@@ -129,7 +129,7 @@ class ComponentExample extends Component {
}

copyJSX = () => {
copyToClipboard(this.getOriginalSourceCode())
copyToClipboard(this.state.sourceCode)
Copy link
Member Author

Choose a reason for hiding this comment

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

Bug fix, an example's copy button was copying the original source code. This update makes it copy the current state of the editor.

@levithomason levithomason force-pushed the feat/input-focus branch 2 times, most recently from 38de9e9 to 95c0a7e Compare March 18, 2017 06:51
@codecov-io
Copy link

codecov-io commented Mar 18, 2017

Codecov Report

Merging #1477 into master will increase coverage by <.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #1477      +/-   ##
==========================================
+ Coverage   99.74%   99.74%   +<.01%     
==========================================
  Files         141      141              
  Lines        2368     2371       +3     
==========================================
+ Hits         2362     2365       +3     
  Misses          6        6
Impacted Files Coverage Δ
src/elements/Button/ButtonOr.js 100% <ø> (ø)
src/elements/Input/Input.js 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 67c737f...6efe8a3. Read the comment docs.

@@ -34,10 +34,10 @@ ButtonOr.propTypes = {
className: PropTypes.string,

/** Or buttons can have their text localized, or adjusted by using the text prop. */
text: PropTypes.oneOfType(
text: PropTypes.oneOfType([
Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed a bad propType argument.

@levithomason
Copy link
Member Author

Released in semantic-ui-react@0.67.2.

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