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

ResponsiveWrapper does not correctly render images wrapped in Button #53886

Open
markjaquith opened this issue Aug 23, 2023 · 0 comments
Open
Labels
[Block] Buttons Affects the Buttons Block [Package] Components /packages/components [Type] Enhancement A suggestion for improvement.

Comments

@markjaquith
Copy link
Member

Description

I expect to be able to pass anything to ResponsiveWrapper... not just an image tag. Something about the new aspect ratio stuff is causing images to render with zero height when wrapped in a Button.

This worked before WordPress 6.3.

I know I can just attach an onClick to the image, but that's not good for accessibility. Buttons are for tapping things. If I wrap an image in a button, browsers know that this is a thing that can be pressed, and accessibility is handled.

Step-by-step reproduction instructions

			<MediaUpload
				onSelect={onSelectMedia}
				allowedTypes={['image']}
				multiple={false}
				value={media}
				render={({ open }) => (
					<ResponsiveWrapper
						naturalWidth={ media.media_details.width }
						naturalHeight={ media.media_details.height }
					>
						<Button onClick={open}><img src={media.source_url} /></Button>
					</ResponsiveWrapper>
				)}
			/>

Screenshots, screen recording, code snippet

CleanShot 2023-08-22 at 23 18 24@2x

Environment info

WordPress 6.3

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@jordesign jordesign added [Type] Enhancement A suggestion for improvement. [Block] Buttons Affects the Buttons Block labels Aug 23, 2023
@skorasaurus skorasaurus added the [Package] Components /packages/components label Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Buttons Affects the Buttons Block [Package] Components /packages/components [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

3 participants