Closed Bug 1760231 Opened 3 years ago Closed 1 month ago

Better support "learn more" link/button without infobar configuration workarounds

Categories

(Firefox :: Messaging System, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED

People

(Reporter: Mardak, Unassigned)

References

(Blocks 1 open bug)

Details

We can get a support link to show up as "learn more" by configuring one of the buttons as:

{
	"label": {
		"string_id": "notification-learnmore-default-label"
	},
	"supportPage": "dns-over-https",
	"callback": null,
	"action": {
		"type": "CANCEL"
	}
}

Currently the label object is required as well as button callback assumes it's either primary or secondary:
https://searchfox.org/mozilla-central/rev/656c0068e50e245779349ee60f7cc4f96e64add9/browser/components/newtab/lib/InfoBar.jsm#67,70,93-95

The required label overrides the default "learn more" text:
https://searchfox.org/mozilla-central/rev/656c0068e50e245779349ee60f7cc4f96e64add9/toolkit/content/widgets/notificationbox.js#466,470-471

And the callback's lack of truthy return results in the infobar closing on clicking the link:
https://searchfox.org/mozilla-central/rev/656c0068e50e245779349ee60f7cc4f96e64add9/toolkit/content/widgets/notificationbox.js#587-589

The action is working around message checks/validation expecting an action:
https://github.com/mozilla/messaging-system-inflight-assets/blob/d7191940bba55745debddfe69c8f459495a7d7d1/scripts/validate.py#L101-L106

I think the button could be configured as just:

{
	"supportPage": "dns-over-https"
}
Priority: -- → P2
Status: NEW → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.