Skip to content
This repository was archived by the owner on Feb 10, 2022. It is now read-only.

Commit 4828df1

Browse files
author
Dongjin Jung
authored
Merge pull request #5 from sendbird/feature/calls-973
[CALLS-973] Add alt property into img tags
2 parents 27109c2 + ed27a8f commit 4828df1

File tree

5 files changed

+28
-17
lines changed

5 files changed

+28
-17
lines changed

lib/utils/domUtil.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,12 @@ export function createButton({ id, className, innerText } = {}) {
111111
return _createElement({ tagName: 'button', id: id, className: className, innerText: innerText });
112112
}
113113

114-
export function createImg({ id, className, src, onerror } = {}) {
114+
export function createImg({ id, className, src, alt, onerror } = {}) {
115115
const element = _createElement({
116116
tagName: 'img',
117117
id: id,
118118
className: className,
119-
attrs: { src: src }
119+
attrs: { src, alt }
120120
});
121121

122122
element.onerror = onerror;

lib/views/CallLogItem.js

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,22 @@ export class CallLogItem {
1212
if(callLogInfo) {
1313
const wrapper = createListItem({ id: callLogInfo.callId, className: className });
1414
let callType = null;
15+
let callTypeAlt = '';
1516
if(callLogInfo.isVideoCall){
1617
if(callLogInfo.userRole === 'dc_caller'){
1718
callType = outgoingVideo;
19+
callTypeAlt = 'Outgoing call history';
1820
} else {
1921
callType = incomingVideo;
22+
callTypeAlt = 'Incoming call history';
2023
}
2124
} else {
2225
if(callLogInfo.userRole === 'dc_caller'){
2326
callType = outgoingVoice;
27+
callTypeAlt = 'Outgoing call history';
2428
} else {
2529
callType = incomingVoice;
30+
callTypeAlt = 'Incoming call history';
2631
}
2732
}
2833

@@ -36,14 +41,19 @@ export class CallLogItem {
3641
displayName = callLogInfo.caller.userId;
3742
}
3843

39-
const icoCallType = createImg({ className: `${classes['callLogItemType']}`, src: callType });
44+
const icoCallType = createImg({ className: `${classes['callLogItemType']}`, src: callType, alt: callTypeAlt });
4045
const callTypeDiv = createDiv({ className: `${classes['callLogTypeDiv']}` });
4146
callTypeDiv.appendChild(icoCallType);
4247

43-
const profileImg = createImg({ className: `${classes['callLogProfileImg']}`, src: profileImage, onerror: (error) => {
44-
error.currentTarget.src = avatarIcon;
45-
}});
46-
48+
const profileImg = createImg({
49+
className: `${classes['callLogProfileImg']}`,
50+
src: profileImage,
51+
alt: 'Opponent profile photo of call history',
52+
onerror: (error) => {
53+
error.currentTarget.src = avatarIcon;
54+
}
55+
});
56+
4757
const profileDiv = createDiv({ className: `${classes['callLogProfileDiv']}` });
4858
profileDiv.appendChild(profileImg);
4959

@@ -85,12 +95,12 @@ export class CallLogItem {
8595
const btnCallVoice = createDiv({ className: `${classes['callLogVoiceActionBtn']}`});
8696
callActionBtnWrap.appendChild(btnCallVoice);
8797
callActionBtnWrap.appendChild(btnCallVideo);
88-
89-
98+
99+
90100
const callLogActionDiv = createDiv({ className: `${classes['callLogActionDiv']}` });
91101
callLogActionDiv.appendChild(callLogStartTime);
92102
callLogActionDiv.appendChild(callActionBtnWrap);
93-
103+
94104

95105
wrapper.appendChild(callTypeDiv);
96106
wrapper.appendChild(profileDiv);
@@ -135,4 +145,4 @@ export class CallLogItem {
135145
eventhandler(event, {peerId: this.destPeerID, isVideoCall: false, callOption: null});
136146
};
137147
}
138-
}
148+
}

lib/views/CallView.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export default class CallView extends BaseElement {
2424

2525
this.peerProfile = createImg({
2626
src: remoteUser.profileUrl,
27+
alt: 'Sendbird voice & video call opponent profile photo',
2728
className: classes['remoteProfile'],
2829
onerror: (e) => e.target.style.visibility = 'hidden'
2930
});

views/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<body>
1212
<div id="container" class="wrapper center bg-white">
1313
<div id="welcome_view" class="column center">
14-
<img src="<%=require('../img/ic-logo-horizontal-purple-300.svg')%>" class="ic-logo-horizontal-purple-300">
14+
<img src="<%=require('../img/ic-logo-horizontal-purple-300.svg')%>" alt="Sendbird horizontal logo svg icon" class="ic-logo-horizontal-purple-300">
1515
<div class="title voice-sample-page">
1616
Calls Sample
1717
</div>
@@ -30,4 +30,4 @@
3030
</div>
3131
</body>
3232

33-
</html>
33+
</html>

views/widget.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
<body>
1111
<div id="container" class="wrapper center">
1212
<div id="welcome_view" class="column center">
13-
<img src="<%=require('../img/ic-logo-horizontal-purple-300.svg')%>" class="ic-logo-horizontal-purple-300" />
13+
<img src="<%=require('../img/ic-logo-horizontal-purple-300.svg')%>" alt="Sendbird horizontal logo svg icon" class="ic-logo-horizontal-purple-300" />
1414
<div class="voice-sample-page title">
1515
Voice Sample Login
1616
</div>
1717
<div class="voice-sample-desc desc">
1818
This is the Voice Sample page. To try our
1919
Voice widget, please click the button below.
2020
</div>
21-
<img src="<%=require('../img/ic-arrow-down-right-24.svg')%>" class="ic-arrow-down-right-24" />
21+
<img src="<%=require('../img/ic-arrow-down-right-24.svg')%>" alt="arrow-down-right" class="ic-arrow-down-right-24" />
2222
</div>
2323
<div id="widget_tooltip" class="widget-tooltip column center bg-dark">
2424
<div class="smile-face">
@@ -27,11 +27,11 @@
2727
<label class="desc-light">
2828
To try Voice Widget, please click the icon
2929
</label>
30-
<img src="<%=require('../img/img-tooltip-tail-down.svg')%>" class="img-tooltip-tail-down" />
30+
<img src="<%=require('../img/img-tooltip-tail-down.svg')%>" alt="tooltip-tail-down" class="img-tooltip-tail-down" />
3131
</div>
3232
<div id="widget" class="widget">
3333
</div>
3434
</div>
3535
</body>
3636

37-
</html>
37+
</html>

0 commit comments

Comments
 (0)