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

How can I avoid accessibility to set isHeader? #5205

Open
conandi opened this issue Oct 12, 2024 · 0 comments
Open

How can I avoid accessibility to set isHeader? #5205

conandi opened this issue Oct 12, 2024 · 0 comments

Comments

@conandi
Copy link

conandi commented Oct 12, 2024

internal struct AccessibleHeader {
    static func create(usingChart chart: ChartViewBase,
                                andData data: ChartData,
                                withDefaultDescription defaultDescription: String = "Chart") -> NSUIAccessibilityElement
    {
        let chartDescriptionText = chart.chartDescription.text ?? defaultDescription
        let dataSetDescriptions = data.map { $0.label ?? "" }
        let dataSetDescriptionText = dataSetDescriptions.joined(separator: ", ")

        let element = NSUIAccessibilityElement(accessibilityContainer: chart)
        element.accessibilityLabel = chartDescriptionText + ". \(data.count) dataset\(data.count == 1 ? "" : "s"). \(dataSetDescriptionText)"
        element.accessibilityFrame = chart.bounds
        element.isHeader = true
        
        return element
    }
}

How can I avoid to set isHeader?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@conandi and others