help() view modifier

I have a bunch of Buttons with a .help(Text("Help text")) modifier, inside of a VStack which has its own .help() modifier describing the entire section.

The VStack help shows up only when I hover over the buttons, and the Button help never shows at all.

If I comment out the VStack help, the individual button helps show.

How do I get both to show up properly? I want the VStack to show if I am in the roundedBorder, unless I am over a Button with its own .help modifier.

import SwiftUI

struct BugReport: View {
  @State private var testp1 = false
  @State private var testp2 = false
    var body: some View {
      VStack {
        Text("Hello, World!")
        Button("Test1") {
          testp1.toggle()
        }
        .help("Change the test1")
        Button("Test2") {
          testp2.toggle()
        }
        .help("Change the test2")
      }
      .help("Testing stuff")
      .roundedBorder(color: .black)
    }
}

#Preview {
    BugReport()
}

Hello hacksaw,

For clarification, is this for a macOS application? And what is the .roundedBorder modifier you are referring to?

Thank you for your patience,

Richard Yeh ||  Developer Technical Support

Ooops, forgot I wrote that modifier, here it is:

extension View {
  func roundedBorder(style: StrokeStyle = StrokeStyle(lineWidth: 1.0), color: Color = Color(#colorLiteral(red: 0.8039215803, green: 0.8039215803, blue: 0.8039215803, alpha: 1))) -> some View {
    modifier(RoundedBorder(strokeStyle: style, color: color))
  }
}

This is for macOS, yep.

Note commenting out the roundedBorder modifier doesn't change this behaviour.

Hello hacksaw,

Thank you for the clarification. It is generally not recommended to have nested .help tooltips, please see the Offering help design guide:

Describe only the control that people indicate interest in. When people want to know how to use a specific control, they don’t want to learn how to use nearby controls or how to perform a larger task.

You could also consider using the TipKit framework to display contextual hints to users. Alternatively, if the intention of using the .hint modifier is to provide accessibility access, accessibilityLabel(_:) or accessibilityHint(_:) would be the appropriate choices.

Please don't hesitate to file a file an enhancement request using Feedback Assistant for us to improve or clarify the behavior. After filing, please post the FB number to this thread. If you're not familiar with how to file enhancement requests, take a look at Bug Reporting: How and Why?

Thank you for your patience,

Richard Yeh,  Developer Technical Support

help() view modifier
 
 
Q