mirror of
				https://github.com/Jermolene/TiddlyWiki5
				synced 2025-10-31 15:42:59 +00:00 
			
		
		
		
	Added aria-label attribute to link widget
And document it for the button widget
This commit is contained in:
		| @@ -87,6 +87,9 @@ LinkWidget.prototype.renderLink = function(parent,nextSibling) { | ||||
| 			}); | ||||
| 		domNode.setAttribute("title",tooltipText); | ||||
| 	} | ||||
| 	if(this["aria-label"]) { | ||||
| 		domNode.setAttribute("aria-label",this["aria-label"]); | ||||
| 	} | ||||
| 	// Add a click event handler | ||||
| 	$tw.utils.addEventListeners(domNode,[ | ||||
| 		{name: "click", handlerObject: this, handlerMethod: "handleClickEvent"}, | ||||
| @@ -176,8 +179,9 @@ Compute the internal state of the widget | ||||
| LinkWidget.prototype.execute = function() { | ||||
| 	// Get the target tiddler title | ||||
| 	this.to = this.getAttribute("to",this.getVariable("currentTiddler")); | ||||
| 	// Get the link title | ||||
| 	// Get the link title and aria label | ||||
| 	this.tooltip = this.getAttribute("tooltip"); | ||||
| 	this["aria-label"] = this.getAttribute("aria-label"); | ||||
| 	// Determine the link characteristics | ||||
| 	this.isMissing = !this.wiki.tiddlerExists(this.to); | ||||
| 	this.isShadow = this.wiki.isShadowTiddler(this.to); | ||||
| @@ -190,7 +194,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of | ||||
| */ | ||||
| LinkWidget.prototype.refresh = function(changedTiddlers) { | ||||
| 	var changedAttributes = this.computeAttributes(); | ||||
| 	if(changedAttributes.to || changedTiddlers[this.to] || changedAttributes.tooltip) { | ||||
| 	if(changedAttributes.to || changedTiddlers[this.to] || changedAttributes["aria-label"] || changedAttributes.tooltip) { | ||||
| 		this.refreshSelf(); | ||||
| 		return true; | ||||
| 	} | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| title: ButtonWidget | ||||
| created: 201310241419 | ||||
| modified: 201403150837 | ||||
| modified: 201406170837 | ||||
| tags: widget | ||||
|  | ||||
| ! Introduction | ||||
| @@ -23,6 +23,7 @@ The content of the `<$button>` widget is displayed within the button. | ||||
| |set |A TextReference to which a new value will be assigned | | ||||
| |setTo |The new value to assign to the TextReference identified in the `set` attribute | | ||||
| |popup |Title of a state tiddler for a popup that is toggled when the button is clicked | | ||||
| |aria-label |Optional [[Accessibility]] label | | ||||
| |class |An optional CSS class name to be assigned to the HTML element | | ||||
| |style |An optional CSS style attribute to be assigned to the HTML element | | ||||
| |selectedClass |An optional additional CSS class to be assigned if the popup is triggered or the tiddler specified in `set` already has the value specified in `setTo`  | | ||||
|   | ||||
| @@ -1,4 +1,6 @@ | ||||
| title: LinkWidget | ||||
| created: 201310241419 | ||||
| modified: 201406170837 | ||||
| tags: widget | ||||
|  | ||||
| The `link` widget generates links to tiddlers. | ||||
| @@ -7,6 +9,7 @@ The `link` widget generates links to tiddlers. | ||||
|  | ||||
| |!Attribute |!Description | | ||||
| |to |The title of the target tiddler for the link (defaults to the [[WidgetVariable: currentTiddler]]) | | ||||
| |aria-label |Optional [[Accessibility]] label | | ||||
| |tooltip |Optional tooltip WikiText | | ||||
|  | ||||
| The content of the link widget is rendered within the `<a>` tag. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Jermolene
					Jermolene