# TextBox: specified height size works locally, but isn't translated to pavlovia

**URL:** <https://discourse.psychopy.org/t/textbox-specified-height-size-works-locally-but-isnt-translated-to-pavlovia/16870>\
**Category:** Online experiments\
**Tags:** pavlovia\
**Created:** [September 29, 2020, 12:46am UTC](https://discourse.psychopy.org/t/textbox-specified-height-size-works-locally-but-isnt-translated-to-pavlovia/16870 "2020-09-29T00:46:31Z")\
**Posts on this page:** 8\
**Page:** 2

<div class="post-metadata">

**Author:** ![sotiri](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@sotiri](https://discourse.psychopy.org/u/sotiri)\
**Post date:** [February 17, 2021, 5:33pm UTC](https://discourse.psychopy.org/t/textbox-specified-height-size-works-locally-but-isnt-translated-to-pavlovia/16870/21 "2021-02-17T17:33:28Z")

</div>

Hi @chayabenyehuda, alright, cool, thanks for giving me access. While a permanent fix should be available with the upcoming release, for now you need to manually edit the main script to include the `multiline` attribute when instatiating the `textbox` component like you have very correctly done in this project.

I apologise for the inconvenience of having the program revert back that change each time you export HTML. Not sure how well it would fit your particular use case, but you have the option of telling PsychoPy to only export HTML on demand rather than on sync via the online settings tab as shown below,

 ![Screenshot 2021-02-17 at 17.26.12](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/8/6/86cc9107fc8b90e06a4968f03b16bab806e51108.jpeg)

Please let me know if you need more support, here to help, x

---

<div class="post-metadata">

**Author:** ![chayabenyehuda](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/chayabenyehuda/32/12429_2.png) [@chayabenyehuda](https://discourse.psychopy.org/u/chayabenyehuda)\
**Post date:** [February 17, 2021, 6:24pm UTC](https://discourse.psychopy.org/t/textbox-specified-height-size-works-locally-but-isnt-translated-to-pavlovia/16870/22 "2021-02-17T18:24:41Z")

</div>

thank you for the help! ill just change it right before I publish the project 🙂

---

<div class="post-metadata">

**Author:** ![sotiri](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@sotiri](https://discourse.psychopy.org/u/sotiri)\
**Post date:** [March 8, 2021, 8:42pm UTC](https://discourse.psychopy.org/t/textbox-specified-height-size-works-locally-but-isnt-translated-to-pavlovia/16870/23 "2021-03-08T20:42:09Z")

</div>

Dear @sawal, @PSYresearcher, @chayabenyehuda, OK PsychoPy latest now declares JS TextBox instances as multiline by default and no custom edits should be required to make the height setting work as expected. Please let me know if you hit any hurdles post upgrade, x

---

<div class="post-metadata">

**Author:** ![chayabenyehuda](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/chayabenyehuda/32/12429_2.png) [@chayabenyehuda](https://discourse.psychopy.org/u/chayabenyehuda)\
**Post date:** [March 9, 2021, 2:25pm UTC](https://discourse.psychopy.org/t/textbox-specified-height-size-works-locally-but-isnt-translated-to-pavlovia/16870/24 "2021-03-09T14:25:26Z")

</div>

Hi

Yes the size is great but now i have a new problem described here:  
I Got a strange textbox-issue in this experiment: the routine “welcome” registers a keyboard response, then continues to the textbox\_2 routine, which presents an editable textbox. However, the textbox doesn’t record any text unless I click on the keys for a long time. If I remove the welcome routine, then it does.

> <https://github.com/psychopy/psychojs/issues/287>
>
> Got a strange textbox-issue in this experiment: the routine "welcome" registers a keyboard response, then continues to the textbox\_2 routine, whic...

---

<div class="post-metadata">

**Author:** ![sotiri](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@sotiri](https://discourse.psychopy.org/u/sotiri)\
**Post date:** [March 10, 2021, 10:56pm UTC](https://discourse.psychopy.org/t/textbox-specified-height-size-works-locally-but-isnt-translated-to-pavlovia/16870/25 "2021-03-10T22:56:19Z")

</div>

Hi @chayabenyehuda, OK that needs fixing on our end, sorry. For now, I believe the following should work when placed in a _Before Experiment_ custom code component tab:

```auto
core.Keyboard.prototype._addKeyListeners = function() {
  this._previousKeydownKey = undefined;
  const self = this;
  window.addEventListener("keydown", (event) => {
    if (event.repeat) {
      return;
    }
    const timestamp = util.MonotonicClock.getReferenceTime();
    if (this._status !== PsychoJS.Status.STARTED) {
      return;
    }
    self._previousKeydownKey = event.key;
    let code = event.code;
    if (typeof code === 'undefined') {
      code = core.EventManager.keycode2w3c(event.keyCode);
    }
    let pigletKey = core.EventManager.w3c2pyglet(code);
    self._bufferIndex = (self._bufferIndex + 1) % self._bufferSize;
    self._bufferLength = Math.min(self._bufferLength + 1, self._bufferSize);
    self._circularBuffer[self._bufferIndex] = {
      code,
      key: event.key,
      pigletKey,
      status: core.Keyboard.KeyStatus.KEY_DOWN,
      timestamp
    };
    self._unmatchedKeydownMap.set(event.code, self._bufferIndex);
    self._psychoJS.logger.trace('keydown: ', event.key);
    event.stopPropagation();
  });
}

```

---

<div class="post-metadata">

**Author:** ![chayabenyehuda](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/chayabenyehuda/32/12429_2.png) [@chayabenyehuda](https://discourse.psychopy.org/u/chayabenyehuda)\
**Post date:** [March 11, 2021, 6:13am UTC](https://discourse.psychopy.org/t/textbox-specified-height-size-works-locally-but-isnt-translated-to-pavlovia/16870/26 "2021-03-11T06:13:47Z")

</div>

> [@sotiri](#):
>
> ```auto
> core.Keyboard.prototype._addKeyListeners = function() {
> this._previousKeydownKey = undefined;
> const self = this;
> window.addEventListener("keydown", (event) => {
> if (event.repeat) {
> return;
> }
> const timestamp = util.MonotonicClock.getReferenceTime();
> if (this._status !== PsychoJS.Status.STARTED) {
> return;
> }
> self._previousKeydownKey = event.key;
> let code = event.code;
> if (typeof code === 'undefined') {
> code = core.EventManager.keycode2w3c(event.keyCode);
> }
> let pigletKey = core.EventManager.w3c2pyglet(code);
> self._bufferIndex = (self._bufferIndex + 1) % self._bufferSize;
> self._bufferLength = Math.min(self._bufferLength + 1, self._bufferSize);
> self._circularBuffer[self._bufferIndex] = {
> code,
> key: event.key,
> pigletKey,
> status: core.Keyboard.KeyStatus.KEY_DOWN,
> timestamp
> };
> self._unmatchedKeydownMap.set(event.code, self._bufferIndex);
> self._psychoJS.logger.trace('keydown: ', event.key);
> event.stopPropagation();
> });
> }
> 
> ```

thank you! ill try it once Pavlovia will be up and running 🙂

---

<div class="post-metadata">

**Author:** ![chayabenyehuda](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/chayabenyehuda/32/12429_2.png) [@chayabenyehuda](https://discourse.psychopy.org/u/chayabenyehuda)\
**Post date:** [March 11, 2021, 9:36pm UTC](https://discourse.psychopy.org/t/textbox-specified-height-size-works-locally-but-isnt-translated-to-pavlovia/16870/27 "2021-03-11T21:36:42Z")

</div>

I have tried it now and it works nicely

---

<div class="post-metadata">

**Author:** ![sotiri](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@sotiri](https://discourse.psychopy.org/u/sotiri)\
**Post date:** [April 16, 2021, 9:49am UTC](https://discourse.psychopy.org/t/textbox-specified-height-size-works-locally-but-isnt-translated-to-pavlovia/16870/28 "2021-04-16T09:49:50Z")

</div>

Hi @sawal, @PSYresearcher, @chayabenyehuda, OK the newly released PsychoPy 2021.1.4 should now respect the size attribute on TextBox instances without JS patching, x

[Previous page](https://discourse.psychopy.org/t/textbox-specified-height-size-works-locally-but-isnt-translated-to-pavlovia/16870.md?page=1)
