Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Adding padding to a view contained in a Button causes the Button to disappear #403

Closed
foscomputerservices opened this issue May 14, 2021 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@foscomputerservices
Copy link
Contributor

When adding padding to the content of a Button, the <button> is no longer rendered in the HTML.

struct ContentView: View {
    var body: some View {
        Button {
        } label: {
            Text("Button")
                .padding()
        }
    }
}

Removing the .padding() restores the button in the output.

Screenshots
(I could provide a screenshot, but just envision a blank screen, we'll save a few bytes on GitHub 😁)

This is using the latest code on the main branch.

@foscomputerservices foscomputerservices added the bug Something isn't working label May 14, 2021
MaxDesiatov pushed a commit that referenced this issue Jun 7, 2021
Currently, `DOMRenderer` can only handle `Button`s where is the label is `Text`. If it is any other `View`, the `Button` is not rendered. This is the cause of #403.

This PR removes this restriction. Additionally, it expands the `ButtonStyle` demo to include `Button`s with complex labels.
@MaxDesiatov
Copy link
Collaborator

Closing this as resolved in #409.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants