forked from streamlit/streamlit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fullscreen Button Overflow Horizontally (streamlit#8279)
## Describe your changes As of now, our full screen button goes outside of the boundary, which in some viewports can cause overflowing widths to make the container scrollable. We intend to make the full screen button experience not as bad, but for now, the solution is to reduce the content area size when we hit this threshold. ## GitHub Issue Link (if applicable) Closes streamlit#6990 ## Testing Plan - E2E Test to capture the look created from the bug. --- **Contribution License Agreement** By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.
- Loading branch information
Showing
29 changed files
with
122 additions
and
43 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Binary file added
BIN
+3.93 KB
...napshots__/linux/responsive_test/page_fullscreen_button_edge_case[chromium].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.07 KB
...snapshots__/linux/responsive_test/page_fullscreen_button_edge_case[firefox].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.37 KB
..._snapshots__/linux/responsive_test/page_fullscreen_button_edge_case[webkit].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.25 KB
...linux/st_columns_layout_test/columns-layout-horizontal[dark_theme-chromium].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.1 KB
.../linux/st_columns_layout_test/columns-layout-horizontal[dark_theme-firefox].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.17 KB
..._/linux/st_columns_layout_test/columns-layout-horizontal[dark_theme-webkit].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.27 KB
...inux/st_columns_layout_test/columns-layout-horizontal[light_theme-chromium].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.1 KB
...linux/st_columns_layout_test/columns-layout-horizontal[light_theme-firefox].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.18 KB
.../linux/st_columns_layout_test/columns-layout-horizontal[light_theme-webkit].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.15 KB
..._/linux/st_columns_layout_test/columns-layout-vertical[dark_theme-chromium].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.18 KB
...__/linux/st_columns_layout_test/columns-layout-vertical[dark_theme-firefox].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.91 KB
...s__/linux/st_columns_layout_test/columns-layout-vertical[dark_theme-webkit].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.12 KB
.../linux/st_columns_layout_test/columns-layout-vertical[light_theme-chromium].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.29 KB
..._/linux/st_columns_layout_test/columns-layout-vertical[light_theme-firefox].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.91 KB
...__/linux/st_columns_layout_test/columns-layout-vertical[light_theme-webkit].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.34 KB
.../linux/st_columns_layout_test/columns-with-one-element[dark_theme-chromium].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.25 KB
..._/linux/st_columns_layout_test/columns-with-one-element[dark_theme-firefox].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.08 KB
...__/linux/st_columns_layout_test/columns-with-one-element[dark_theme-webkit].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.31 KB
...linux/st_columns_layout_test/columns-with-one-element[light_theme-chromium].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.29 KB
.../linux/st_columns_layout_test/columns-with-one-element[light_theme-firefox].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.11 KB
..._/linux/st_columns_layout_test/columns-with-one-element[light_theme-webkit].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022-2024) | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import numpy as np | ||
|
||
import streamlit as st | ||
|
||
img = np.repeat(0, 3000 * 800).reshape(800, 3000) | ||
st.image(img) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022-2024) | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from playwright.sync_api import Page, expect | ||
|
||
from e2e_playwright.conftest import ImageCompareFunction | ||
|
||
|
||
def test_fullscreen_button_edge_case(app: Page, assert_snapshot: ImageCompareFunction): | ||
"""Test that window doesn't oveflow with window""" | ||
app.set_viewport_size({"width": 780, "height": 400}) | ||
image = app.get_by_test_id("stFullScreenFrame") | ||
expect(image).to_have_count(1) | ||
image.hover() | ||
expect(app.get_by_test_id("StyledFullScreenButton")).to_have_css("opacity", "1") | ||
|
||
assert_snapshot(app, name="page_fullscreen_button_edge_case") |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022-2024) | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from playwright.sync_api import Page, expect | ||
|
||
from e2e_playwright.conftest import ImageCompareFunction | ||
|
||
|
||
def test_show_columns_horizontally_when_viewport_allows( | ||
themed_app: Page, assert_snapshot: ImageCompareFunction | ||
): | ||
"""shows columns horizontally when viewport > 640""" | ||
themed_app.set_viewport_size({"width": 641, "height": 800}) | ||
horizontal_blocks = themed_app.get_by_test_id("stHorizontalBlock") | ||
expect(horizontal_blocks).to_have_count(2) | ||
|
||
assert_snapshot(horizontal_blocks.nth(0), name="columns-layout-horizontal") | ||
|
||
|
||
def test_show_columns_vertically_when_viewport_requires( | ||
themed_app: Page, assert_snapshot: ImageCompareFunction | ||
): | ||
"""stacks columns vertically when viewport <= 640""" | ||
themed_app.set_viewport_size({"width": 640, "height": 800}) | ||
horizontal_blocks = themed_app.get_by_test_id("stHorizontalBlock") | ||
expect(horizontal_blocks).to_have_count(2) | ||
|
||
assert_snapshot(horizontal_blocks.nth(0), name="columns-layout-vertical") | ||
|
||
|
||
def test_columns_always_take_up_space( | ||
themed_app: Page, assert_snapshot: ImageCompareFunction | ||
): | ||
"""columns still takes up space with no elements present""" | ||
horizontal_blocks = themed_app.get_by_test_id("stHorizontalBlock") | ||
expect(horizontal_blocks).to_have_count(2) | ||
|
||
assert_snapshot(horizontal_blocks.nth(1), name="columns-with-one-element") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters