Focus CW field when enabling it, focus compose textarea when disabling it

Port a99179d31f and 09147186b7
to glitch-soc
This commit is contained in:
Thibaut Girka
2018-08-18 20:53:46 +02:00
committed by ThibG
parent 484b9314e3
commit 432f6b88b0
2 changed files with 27 additions and 1 deletions

View File

@@ -33,6 +33,10 @@ const handlers = {
onSubmit();
}
},
handleRefSpoilerText (spoilerText) {
this.spoilerText = spoilerText;
},
};
// The component.
@@ -46,7 +50,7 @@ export default class ComposerSpoiler extends React.PureComponent {
// Rendering.
render () {
const { handleKeyDown } = this.handlers;
const { handleKeyDown, handleRefSpoilerText } = this.handlers;
const {
hidden,
intl,
@@ -68,6 +72,7 @@ export default class ComposerSpoiler extends React.PureComponent {
placeholder={intl.formatMessage(messages.placeholder)}
type='text'
value={text}
ref={handleRefSpoilerText}
/>
</label>
</div>