prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Clicking on a text field in the sidebar (on mobile) causes the sidebar to close.
  # Summary
  
  When the window is too narrow, clicking on a text input in the sidebar causes the sidebar to disappear, making it impossible to type in text. [[video example](https://drive.google.com/file/d/1KetCBECPsg3UAiESZCRdm6W9M_zIrNkc/view?usp=sharing)]
  
  # Steps to reproduce
  
  1. Put a text input in the sidebar.
  2. Make the Streamlit app window narrow.
  3. Click the text input in the sidebar.
  
  ## Expected behavior:
  
  Ideally, the sidebar would stay open and the text input box would have focus and you coudl type something in.
  
  In fact, this _does_ happen when the window is a bit wider. [[video example](https://drive.google.com/file/d/1fObxQWIjkL_5VBJY_niltG489Ki8tRB8/view?usp=sharing)]
  
  ## Actual behavior:
  
  Clicking on a text input in the sidebar causes the sidebar to disappear, making it impossible to type in text. [[video example](https://drive.google.com/file/d/1KetCBECPsg3UAiESZCRdm6W9M_zIrNkc/view?usp=sharing)]
  
  ## Is this a regression?
  
  Unkown
  
  # Debug info
  
  - Streamlit version: `Streamlit, version 0.68.0`
  - Python version: `Python 3.8.5`
  - Using Conda? PipEnv? PyEnv? Pex? `pipenv, version 2020.8.13`
  - OS version: 
  ```
  Distributor ID: Ubuntu
  Description:    Ubuntu 20.04.1 LTS
  Release:        20.04
  Codename:       focal
  ```
  - Browser version: `Safari on iPadOS 14`
  
  </issue>
  <code>
  [start of e2e/scripts/st_sidebar.py]
  1 # Copyright 2018-2020 Streamlit Inc.
  2 #
  3 # Licensed under the Apache License, Version 2.0 (the "License");
  4 # you may not use this file except in compliance with the License.
  5 # You may obtain a copy of the License at
  6 #
  7 #    http://www.apache.org/licenses/LICENSE-2.0
  8 #
  9 # Unless required by applicable law or agreed to in writing, software
  10 # distributed under the License is distributed on an "AS IS" BASIS,
  11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12 # See the License for the specific language governing permissions and
  13 # limitations under the License.
  14 
  15 import streamlit as st
  16 from datetime import datetime
  17 from datetime import date
  18 
  19 w1 = st.sidebar.date_input("Label 1", date(1970, 1, 1))
  20 st.write("Value 1:", w1)
  21 
  22 w2 = st.sidebar.date_input("Label 2", datetime(2019, 7, 6, 21, 15))
  23 st.write("Value 2:", w2)
  24 
  25 x = st.sidebar.text("overwrite me")
  26 x.text("overwritten")
  27
  [end of e2e/scripts/st_sidebar.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/e2e/scripts/st_sidebar.py b/e2e/scripts/st_sidebar.py
  --- a/e2e/scripts/st_sidebar.py
  +++ b/e2e/scripts/st_sidebar.py
  @@ -24,3 +24,5 @@
   
   x = st.sidebar.text("overwrite me")
   x.text("overwritten")
  +
  +y = st.sidebar.text_input("type here")
  
verification_info: {"golden_diff": "diff --git a/e2e/scripts/st_sidebar.py b/e2e/scripts/st_sidebar.py\n--- a/e2e/scripts/st_sidebar.py\n+++ b/e2e/scripts/st_sidebar.py\n@@ -24,3 +24,5 @@\n \n x = st.sidebar.text(\"overwrite me\")\n x.text(\"overwritten\")\n+\n+y = st.sidebar.text_input(\"type here\")\n", "issue": "Clicking on a text field in the sidebar (on mobile) causes the sidebar to close.\n# Summary\r\n\r\nWhen the window is too narrow, clicking on a text input in the sidebar causes the sidebar to disappear, making it impossible to type in text. [[video example](https://drive.google.com/file/d/1KetCBECPsg3UAiESZCRdm6W9M_zIrNkc/view?usp=sharing)]\r\n\r\n# Steps to reproduce\r\n\r\n1. Put a text input in the sidebar.\r\n2. Make the Streamlit app window narrow.\r\n3. Click the text input in the sidebar.\r\n\r\n## Expected behavior:\r\n\r\nIdeally, the sidebar would stay open and the text input box would have focus and you coudl type something in.\r\n\r\nIn fact, this _does_ happen when the window is a bit wider. [[video example](https://drive.google.com/file/d/1fObxQWIjkL_5VBJY_niltG489Ki8tRB8/view?usp=sharing)]\r\n\r\n## Actual behavior:\r\n\r\nClicking on a text input in the sidebar causes the sidebar to disappear, making it impossible to type in text. [[video example](https://drive.google.com/file/d/1KetCBECPsg3UAiESZCRdm6W9M_zIrNkc/view?usp=sharing)]\r\n\r\n## Is this a regression?\r\n\r\nUnkown\r\n\r\n# Debug info\r\n\r\n- Streamlit version: `Streamlit, version 0.68.0`\r\n- Python version: `Python 3.8.5`\r\n- Using Conda? PipEnv? PyEnv? Pex? `pipenv, version 2020.8.13`\r\n- OS version: \r\n```\r\nDistributor ID: Ubuntu\r\nDescription:    Ubuntu 20.04.1 LTS\r\nRelease:        20.04\r\nCodename:       focal\r\n```\r\n- Browser version: `Safari on iPadOS 14`\n", "before_files": [{"content": "# Copyright 2018-2020 Streamlit Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport streamlit as st\nfrom datetime import datetime\nfrom datetime import date\n\nw1 = st.sidebar.date_input(\"Label 1\", date(1970, 1, 1))\nst.write(\"Value 1:\", w1)\n\nw2 = st.sidebar.date_input(\"Label 2\", datetime(2019, 7, 6, 21, 15))\nst.write(\"Value 2:\", w2)\n\nx = st.sidebar.text(\"overwrite me\")\nx.text(\"overwritten\")\n", "path": "e2e/scripts/st_sidebar.py"}]}