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

overflow="hidden" clips the wrong element(s) #602

Open
amcaplan opened this issue Jun 12, 2023 · 1 comment
Open

overflow="hidden" clips the wrong element(s) #602

amcaplan opened this issue Jun 12, 2023 · 1 comment

Comments

@amcaplan
Copy link

amcaplan commented Jun 12, 2023

In this code sample, I'd expect lines 1 and 2 to appear.

import React from 'react';
import {render, Box, Text} from '../../src/index.js';

function IncorrectClipping() {
	return (
		<Box height={2} width={10} flexDirection="column" overflow="hidden">
			<Box height={1} width={15}>
				<Text>Line 1 is very long.</Text>
			</Box>
			<Box height={1} width={15}>
				<Text>Line 2 is also very long.</Text>
			</Box>
			<Box height={1} width={15}>
				<Text>Line 3 should be invisible.</Text>
			</Box>
		</Box>
	);
}

render(<IncorrectClipping />);

Instead, they are rendered as:

Line 1 is
Line 3 sho

If you add more lines to the sample, it continues to render one of the lower lines rather than the expected overflow line being cut off. And eventually it starts from a lower line, too. With 9 lines, for example, it renders lines 3 and 7.

import React from 'react';
import {render, Box, Text} from '../../src/index.js';

function IncorrectClipping() {
	return (
		<Box height={2} width={10} flexDirection="column" overflow="hidden">
			<Box height={1} width={15}>
				<Text>Line 1 is very long.</Text>
			</Box>
			<Box height={1} width={15}>
				<Text>Line 2 is also very long.</Text>
			</Box>
			<Box height={1} width={15}>
				<Text>Line 3 should be invisible.</Text>
			</Box>
			<Box height={1} width={15}>
				<Text>Line 4, doubly so.</Text>
			</Box>
			<Box height={1} width={15}>
				<Text>Line 5, absolutely.</Text>
			</Box>
			<Box height={1} width={15}>
				<Text>Line 6, even more.</Text>
			</Box>
			<Box height={1} width={15}>
				<Text>Line 7, indubitably.</Text>
			</Box>
			<Box height={1} width={15}>
				<Text>Line 8, without fail.</Text>
			</Box>
			<Box height={1} width={15}>
				<Text>Line 9, yup.</Text>
			</Box>
		</Box>
	);
}

render(<IncorrectClipping />);
Line 3 sho
Line 7, ev
@jeroenptrs
Copy link

jeroenptrs commented Aug 19, 2023

Seeing this too, if you want to clip a content box with overflow="hidden" it gets all kinds of weird.

Edit: actively seeing this strange behaviour without overflow as well, just big chunks of text (also rendering each line in its own box + text component) creates a whole lot of weirdness

Screen.Recording.2023-08-19.at.22.26.07.mov

Just rendering a big string immediately solves that issue for me, but it's still weird behaviour (and doesn't solve what I'm trying to do)

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

No branches or pull requests

2 participants