Index: src/wp-includes/media.php
===================================================================
--- src/wp-includes/media.php	(revision 28186)
+++ src/wp-includes/media.php	(working copy)
@@ -1047,12 +1047,15 @@
 
 	$i = 0;
 	foreach ( $attachments as $id => $attachment ) {
-		if ( ! empty( $link ) && 'file' === $link )
-			$image_output = wp_get_attachment_link( $id, $size, false, false );
-		elseif ( ! empty( $link ) && 'none' === $link )
-			$image_output = wp_get_attachment_image( $id, $size, false );
-		else
-			$image_output = wp_get_attachment_link( $id, $size, true, false );
+		$attr = ( trim( $attachment->post_excerpt ) ) ? array( 'aria-describedby' => "$selector-$id" ) : '';
+		
+		if ( ! empty( $link ) && 'file' === $link ) {
+			$image_output = wp_get_attachment_link( $id, $size, false, false, false, $attr );
+		} elseif ( ! empty( $link ) && 'none' === $link ) {
+			$image_output = wp_get_attachment_image( $id, $size, false, $attr );
+		} else {
+			$image_output = wp_get_attachment_link( $id, $size, true, false, false, $attr );
+		}
 
 		$image_meta  = wp_get_attachment_metadata( $id );
 
@@ -1067,7 +1070,7 @@
 			</{$icontag}>";
 		if ( $captiontag && trim($attachment->post_excerpt) ) {
 			$output .= "
-				<{$captiontag} class='wp-caption-text gallery-caption'>
+				<{$captiontag} class='wp-caption-text gallery-caption' id='$selector-$id'>
 				" . wptexturize($attachment->post_excerpt) . "
 				</{$captiontag}>";
 		}
Index: src/wp-includes/post-template.php
===================================================================
--- src/wp-includes/post-template.php	(revision 28186)
+++ src/wp-includes/post-template.php	(working copy)
@@ -1400,9 +1400,10 @@
  * @param bool $permalink Optional, default is false. Whether to add permalink to image.
  * @param bool $icon Optional, default is false. Whether to include icon.
  * @param string|bool $text Optional, default is false. If string, then will be link text.
+ * @param array|string $attr Optional. Array or string of attributes.
  * @return string HTML content.
  */
-function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false ) {
+function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false, $attr = '' ) {
 	$id = intval( $id );
 	$_post = get_post( $id );
 
@@ -1414,12 +1415,13 @@
 
 	$post_title = esc_attr( $_post->post_title );
 
-	if ( $text )
+	if ( $text ) {
 		$link_text = $text;
-	elseif ( $size && 'none' != $size )
-		$link_text = wp_get_attachment_image( $id, $size, $icon );
-	else
+	} elseif ( $size && 'none' != $size ) {
+		$link_text = wp_get_attachment_image( $id, $size, $icon, $attr );
+	} else {
 		$link_text = '';
+	}
 
 	if ( trim( $link_text ) == '' )
 		$link_text = $_post->post_title;
