Bug 7933 - Empty inline elements are invisible even if they have a padding
Summary: Empty inline elements are invisible even if they have a padding
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 420+
Hardware: All All
: P2 Normal
Assignee: Nobody
URL: http://simondorner.com/misc/safari_te...
Keywords: HasReduction, InRadar
Depends on:
Blocks:
 
Reported: 2006-03-23 10:07 PST by Simon Dorner
Modified: 2023-02-25 07:54 PST (History)
13 users (show)

See Also:


Attachments
test case (1.01 KB, text/html)
2006-03-23 10:10 PST, Simon Dorner
no flags Details
Gecko rendering (ff 1.5.0.1) for reference (1.89 KB, image/gif)
2006-03-23 10:11 PST, Simon Dorner
no flags Details
Expanded test case (1.63 KB, text/html)
2006-03-24 03:03 PST, Simon Dorner
no flags Details
Safari 15.5 matches other browser except one test case (526.68 KB, image/png)
2022-06-10 17:25 PDT, Ahmad Saleem
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Dorner 2006-03-23 10:07:43 PST
This one is really simple to describe: It seems to be impossible to give an empty inline element dimensions and make visible. I tried this by giving it some padding.

This works of course if the element contains some characters other than white space. (e.g.   or "x")

The attached test case renders correctly in Gecko-based browsers, for example: http://simondorner.com/misc/safari_testcase_ff_screenshot.gif - Imho all strong and li-elements should be visible. (The container elements have a grey border to better illustrate what's missing)

This makes it impossible to replace text with a visual representation (icon or graphic text) in visual browsers and it's the only Webkit bug (?) that i really run into all the time.
Comment 1 Simon Dorner 2006-03-23 10:10:23 PST
Created attachment 7251 [details]
test case
Comment 2 Simon Dorner 2006-03-23 10:11:56 PST
Created attachment 7252 [details]
Gecko rendering (ff 1.5.0.1) for reference
Comment 3 Dave Hyatt 2006-03-23 17:31:35 PST
Yeah this is a known issue, although it's unclear to me what the correct behavior is.  If you consume/skip whitespace in and around an inline flow, should the inline flow still render?  We decided it shouldn't.
Comment 4 Simon Dorner 2006-03-24 03:01:29 PST
Thanks for the comment! Is there any way to avoid this kind of behavior in current Webkit-based browsers? I'm replacing text with images all the time to create accessible web apps.

I was testing this in different browsers and it seems that Gecko, Opera and iCab all render the inline flow (although Opera doesn't expand the parent elements).
Only IE/Mac renders identically to Webkit; IE/Win doesn't render the inline flow too - but it *does* expand the parent elements as if they contained something.

Is there really no specified way of doing this?

Along the way i ran into a related interesting behavior in Webkit that i can't yet really reduce any further. In my projects i'm replacing text using the "Off Left"-technique: I position the element that i want to remove absolutely and give it a large negative left value (left: -2000px) which visually behaves like "display: none". That way the element is still spoken by today's screen readers and users still have keyboard access to the hidden elements (think access keys for the different sections of a page, for example).

Webkit behaves as expected when i do this; it doesn't render any inline containers of the removed elements - as if they where empty or as if their contents had been removed via "display: none".

But: If i do this for a sequence of inline elements and insert some character into one of the container elements (next to the removed content) all the following elements in the sequence *are* magically rendered.
Comment 5 Simon Dorner 2006-03-24 03:03:27 PST
Created attachment 7278 [details]
Expanded test case

Expanded test case showing both behaviors in action. Maybe this deserves it's own bug?
Comment 6 Joost de Valk (AlthA) 2006-07-09 13:25:10 PDT
Hyatt, what are we going to do with this?
Comment 7 Robert Blaut 2008-03-16 14:53:58 PDT
As I tested today Gecko (Firefox 3) and Presto (Opera 9.5) differs from Webkit on this. I think we should consider to follow other browser in this case to be consistent with them. 
Comment 8 Dave Hyatt 2008-03-17 10:56:40 PDT
We're going to fix it.  We actually got a lot of these tests working.  Now the only ones that fail are empty inlines with DOM content.
Comment 9 Ahmad Saleem 2022-06-10 17:25:52 PDT
Created attachment 460172 [details]
Safari 15.5 matches other browser except one test case

I was able to reproduce this bug using Safari 15.5 on macOS 12.4 in only one test case, where there was difference in rendering from other browser as shown in the picture (as highlighted by pointing green arrow in the attached screenshot).

I reduced the test case further and it is in below test case:

Link - https://jsfiddle.net/g9v5q421/1/

If I am testing incorrectly, please retest accordingly. Thanks!
Comment 10 Radar WebKit Bug Importer 2022-07-06 13:37:29 PDT
<rdar://problem/96544913>
Comment 11 Ahmad Saleem 2023-02-25 07:44:10 PST
Safari Technology Preview 164 also passes failing test mentioned by myself in attached reference screenshot, it might be another IFC progression. CCing 'Alan' to get input and marking this as "RESOLVED CONFIGURATION CHANGED". Thanks!
Comment 12 zalan 2023-02-25 07:54:51 PST
Thank you, this is indeed an IFC progression!