Hello all! :pikachu-hi: I have an issue on the Sa...
# kobweb
c
Hello all! pikachu hi I have an issue on the Safari browser with a TextArea... for some reason the style add through
CssStyle
is not being set (the same for a TextInput) In the image you can see that the Safari (left) is not using the proper styling while on the right Brave/Chrome is using it correctly. Also the
@scope
is properly shown... I'm at this for a couple of hours and can't seem to find what the issue is and why this only happens on an Input (with style text) or a TextArea... Can someone point me in the right direction or tell me what is actually happening? A code snippet which causes it is the following...
Copy code
val TextAreaStyle = CssStyle<TextAreaKind> {
    base {
        Modifier
            .appearance(Appearance.None) // Disable browser styles - critical for Safari
            .backgroundColor(Colors.Transparent)
            .outline(0.px, LineStyle.Solid, Colors.Transparent) // Disable default outline
            .border(0.px, LineStyle.Solid, Colors.Transparent) // Reset default border
    }
}

sealed interface TextAreaKind : ComponentKind

@Composable
fun DsEditableArea(
    modifier: Modifier = Modifier,
    id: String,
    label: String,
    placeholder: String,
    value: String,
    required: Boolean = InputDefaults.Required,
    onValueChange: (String) -> Unit
) {

    Column(
        modifier = modifier
    ) {
        Label(
            attrs = Modifier
                .margin(bottom = 0.5.cssRem)
                .toAttrs(),
            forId = id
        ) {
            Text(value = label)
        }

        TextArea(
            value = value,
            attrs = TextAreaStyle
                .toModifier()
                .toAttrs {
                    attr(Attributes.Name, "Message")
                    if (required) required()
                    placeholder(placeholder)
                    onInput { onValueChange(it.value) }
                }
        )
    }
}
Edit: on the Checkbox it correctly sets the style and also shows up in the inspect tool
I also see this issue on other people there websites made in kobweb, for example the website of
Meet
just above my message has it as well so I feel like this is an internal kobweb issue? ๐Ÿค” https://codingmeet.com/contact_me
s
try
.styleModifier { property("appearance", "none") }
instead of kobweb's overload
and the blue outline might be
BorderFocusColor
which only shows when the textfield has focus
c
Hmm, this seemingly does something, everything added to the
styleModifier
like this does get set... but doesn't it defeat the purpose of the
CssStyle
a little bit? ๐Ÿค”
s
no, that's about Modifiers not CssStyle. look at the source of Modifier.appearance() and check what it does
but I don't see the component styles layer in the safari version at all
c
I do see the component style layer for some other components, only the input (style = text) and textarea is giving me issues. And the
styleModifier
you mention is giving some solace, but only if I duplicate everything from the
CssStyle
into the
styleModifier
as well... which kinda feels wrong ๐Ÿ˜…
s
I meant to just replace
Modifier.appearance(Appearance.None)
with the styleModifier above
c
I think you meant like this?
Copy code
val TextAreaStyle = CssStyle<TextAreaKind> {
    base {
        Modifier
            .styleModifier { property("appearance", "none") }
            .backgroundColor(Colors.Transparent)
            .outline(0.px, LineStyle.Solid, Colors.Transparent) // Disable default outline
            .border(0.px, LineStyle.Solid, Colors.Transparent) // Reset default border
    }
}
Sadly this does nothing at all as well, since this style is not even being set on the input element ๐Ÿ™‚
s
yeah because that's the only difference I have in my code
c
Huh really? That's strange, maybe the issue is somewhere deeper then? ๐Ÿค”
d
Looking into this. Not sure yet what is going on. Actually, I'm trying to inspect my page with safari and the tools are freezing.
I am able to repro safari textareas ignoring the styles I'm trying to apply to them
s
Works for all my sites though
d
@S. I am 99% sure if you change all calls of
.styleModifier { property("appearance", "none") }
to
appearance(Appearance.None)
it will be identical behavior. If that's not the case, I'd love to hear it.
s
me too. seeing that it's in my working code I only suggested to check that
but the entire component styles layer seems to be missing for text input
d
I'm digging. I wouldn't be surprised if Safari is choking on a feature we thought was supported. It's very annoying and maybe concerning that the safari dev tools are choking right now on this stuff. For example, I can't even check console logs. So digging into this is requiring a bit of creativity and is slow going.
๐Ÿ˜… 1
Silk is stalled which is very unfortunate. But I do want to have a TextArea component at some point!
I think the time will come soon to really push forward on adding more Silk widgets so people don't have to do this stuff for themselves.
l
I found this but it should have been fixed in Safari 26.4.
s
that's most likely it. I just checked the coding meet site, which supposedly doesn't work, but it's also displaying fine for me. Version 26.4 (21624.1.16.11.4)
d
Oh! I am still on Safari 26.3.1 (21623.2.7.111.2), I wonder why
s
check for OS updates, I think it's bundled
๐Ÿ‘ 1
d
I usually update pretty aggressively. But yes I just checked for updates on my Mac and it seems like it's time to do a quick update
It's lunch here so perfect time for my computer to take itself out of commission for 30 minutes
OK confirmed! @Christiano you got bit, like I did, by a stale Safari bug. Please update your browser to latest (26.4 or newer; I'm now on 26.5) Thank you for surfacing that info @Letter
kodee excited 1
c
Ooh wow... did not expect it to require an update... but here we are, fixed the issue ๐Ÿ˜… Thanks both for helping me tackle this ๐Ÿ˜Š